I have this request :
private List<IWsResponse> getBPartnerDetails(String valueNetwork, String reportLevel2) {
JdbcTemplate tm = new JdbcTemplate(ds.getDataSource());
StringBuffer sql = new StringBuffer("SELECT * FROM XRV_BPARTNERDETAILS where rownum < 10 order by BPartner_ID");
response = tm.query(sql.toString(), new BPartnerMapper());
return response;
}
in the BPartnerMapper
, i want to do the following :
get the previous elements in the ResultSet to compare it with actual line
@Override
public IWsResponse mapRow(ResultSet rs, int rowNum) throws SQLException {
rs.previous();
int prev_Bpartner_ID = rs.getInt("BPARTNER_ID");
int prev_Location_ID = rs.getInt("BPARTNER_LOCATION_ID");
int prev_User_ID = rs.getInt("User_ID");
rs.next();
int Bpartner_ID = rs.getInt("BPARTNER_ID");
int Location_ID = rs.getInt("BPARTNER_LOCATION_ID");
int User_ID = rs.getInt("User_ID");
// My code
}
I get the error in rs.previous()
:
java.sql.SQLException: Invalid operation for forward only resultset : previous
how can i fix that to get the previous
elements of resultSet