String sql="select seq_nurse_dwcasedradvices.nextval from dual"; QueryResponse queryResponse = this.getJdbcTemplate().queryResult(sql+""); List<Row> rows = queryResponse.getRows(); Long id=null; int i=0; List<NurseDwcasedradvices> list = this.loadAll(); for (NurseDwcasedradvices nurseDwcasedradvices2 : list) { for(Row row:rows) { List<Object> objs=row.getValues(); id = Long.valueOf(objs.get(i)+""); if(nurseDwcasedradvices2.getNoDradvice() == id){ break; } } }