读书人

jdbctemp 事宜

发布时间: 2012-09-08 10:48:07 作者: rapoo

jdbctemp 事务

if(list!=null && list.size()>1){
for(int i=0;i< list.size();i++){
Map recordMap=(Map)list.get(i);
System.out.println(" ================= Record ===== " + recordMap);
int pkKey= Integer.parseInt(recordMap.get("id").toString());

//update chirldren order with parent id
List childrenList=jdbcTemp.queryForList(childrenSql,new Object[]{iBookId,pkKey});

if(childrenList!=null){
for(int j=0;j< childrenList.size();j++){
Map childrenRecordMap=(Map)list.get(j);

System.out.println("=================children Record ===== " + childrenRecordMap);
int childrenPKKey= Integer.parseInt(childrenRecordMap.get("id").toString());
jdbcTemp.update(updateOrderSql,new Object[]{j+2,childrenPKKey});
}
}
//update parent order id.
jdbcTemp.update(updateOrderSql,new Object[]{i+2,pkKey});

}
out.println(" book_id==== ["+sBookId+"]  had not entry! "); 

}
}catch(org.springframework.dao.DataAccessException ex){

读书人网 >其他数据库

热点推荐