Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
List<G_DriverStatus> res = this.getJdbcTemplate().query("select driverid,drivername,min(timedelay) as timedelay from driver_status group by driverid,drivername", new DriverStatusMapper());



Java
<pre lang="xml">private class DriverStatusMapper implements RowMapper<G_DriverStatus>{
        public G_DriverStatus mapRow(ResultSet rs,int i) throws SQLException{
            G_DriverStatus g=new G_DriverStatus();
            g.setDriverid(rs.getString("driverid"));
            g.setDrivername(rs.getString("drivername"));
            g.setTimedelay(rs.getBigDecimal("timedelay"));
            return g;
        }
    }


how to get values from res ?
Posted

1 solution

"res" is a list of G_DriverStatus object. each object represent each row. So just iterate over the list you will get the object and then call the getter method on each object you will get the column value
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900