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;
}
...
.....
}