Hello All ,
I'm implementing the RowMapper to get the result set but it seems that every time i run the query i get a result set of only 1 where i know there are more than one record in the db. Here's my code.
public String method(final Object arg1)
{
// Get the arg1 object and then extract second property.
Generic init = (Generic)arg1;
String name = (String)init.getPriorTwo();
logger.debug("input " + name);
//String name = arg1;
// The Sql statement which will look for programs in the ACS
// cr_items table and extract the id
String sql = "SELECT cr_items.item_id, cr_items.name from cr_items " +
" where cr_items.parent_id=982 and cr_items.name like ? ";
// Assign the parameter and then call the query
final Object[] params = new Object[] { name };
final Generic g = new Generic();
List list = jdbcTemplate.query(sql,params,new RowMapperResultReader(new GenericRowMapper()));
return "yes";
}
and the row mapper implementation
class GenericRowMapper implements RowMapper{
public Object mapRow(ResultSet rs, int index) throws SQLException {
Generic g = new Generic(String.valueOf(rs.getInt("item_id")),rs.ge tString("name"),"");
return g;
}
}
This code runs with no error but returns no more than one record as a result. Any ideas
thank you


Reply With Quote
