1

I have just upgraded Spring dependencies to version 5.3.23 and noticed that class SimpleJdbcDaoSupport and ParameterizedRowMapper are not supported any more. Then how can I accommodate my code upgrading with Spring 5.x?

import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;

public class TestDataAccessDao extends SimpleJdbcDaoSupport {

    
    @SuppressWarnings("deprecation")
    public List<WbClientPU> findClientcodeByPUname(String PUname) {

        final List<WbClientPU> list = new ArrayList<WbClientPU>();

        String sql = "select * from WISEBANKNEXTAC.dbo.WB_CLIENTPU c where c.PUName='"
                + PUname + "'";
        
        try {
            return getSimpleJdbcTemplate().query(sql,
                    new ParameterizedRowMapper<WbClientPU>() {
                        public WbClientPU mapRow(ResultSet rs, int row)
                                throws SQLException {
                            String pacsCode = rs.getString(1);
                            String puname = rs.getString(2);
                            String clientCode = rs.getString(3);

                            WbClientPU clntPu = new WbClientPU();
                            clntPu.setPacsCode(pacsCode);
                            clntPu.setPuName(puname);
                            clntPu.setClientCode(clientCode);
                            list.add(clntPu);

                            return clntPu;
                        }
                    });
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        System.out.println("===== PU List : " + list);
        return list;
    }

    ...
     .....
}
James Z
  • 12,209
  • 10
  • 24
  • 44
  • 1
    That has been removed as the baseline is now JDK8, that support is available in the regualar `JdbcTemplate` and thus no need for `SimpleJdbcTemplate` and friends. – M. Deinum Dec 05 '22 at 09:50

0 Answers0