spring jdbc template rowmapper example
@SuppressWarnings("unchecked")
public ArrayList getSearchResultByColumn_isAdmin(ABCResultForm form, String roleId) {
String query = StringConstants.ABC_RESULT_SEARCH_BY_COLUMN;
System.out.println("Comes here getSearchResultByColumn");
int count = 0;
query = query + " ORDER BY PROCESSING_DATE_START desc ";
return (ArrayList) getJdbcTemplate().query(query,new Object[] {},new RowMapper() {
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
String status;
if (rs.getString(4).equals("11"))
status = "Error";
else
status = "Ok/Warning";
ABCResultDataBean abcResultBean = new ABCResultDataBean(rs.getString(1), rs.getString(2), rs.getString(3), status,
rs.getString(5), rs.getString(6), rs.getString(7), rs.getString(8));
return abcResultBean ;
}
}
);
}
public ArrayList getSearchResultByColumn_isAdmin(ABCResultForm form, String roleId) {
String query = StringConstants.ABC_RESULT_SEARCH_BY_COLUMN;
System.out.println("Comes here getSearchResultByColumn");
int count = 0;
query = query + " ORDER BY PROCESSING_DATE_START desc ";
return (ArrayList) getJdbcTemplate().query(query,new Object[] {},new RowMapper() {
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
String status;
if (rs.getString(4).equals("11"))
status = "Error";
else
status = "Ok/Warning";
ABCResultDataBean abcResultBean = new ABCResultDataBean(rs.getString(1), rs.getString(2), rs.getString(3), status,
rs.getString(5), rs.getString(6), rs.getString(7), rs.getString(8));
return abcResultBean ;
}
}
);
}
Comments
Post a Comment