日期:2014-05-18  浏览次数:20784 次

hibernate 循环删除的问题
private boolean allDelete(IUserContext uc){
boolean bool=false;
Session session = null;
Transaction tx = null;
try{
session = HibernateSessionFactory.getSession();
tx = session.beginTransaction();
String strID[]=uc.getField("custom_field_50").getValue().split(",");
for(int i=0;i<strID.length;i++){
Engine wfuser = Engine.getInstance();
session.delete(session.load(UserTable.class, Integer.parseInt(strID[i])));
bool=wfuser.removeUserDefinition(Integer.parseInt(strID[i]));
if(!bool)
tx.rollback();
}
}catch(Exception ex)
{
ex.printStackTrace();
}finally{
HibernateSessionFactory.closeSession();
}
return true;
}

删除不成功!又不抛异常,有没事务回滚

------解决方案--------------------
tx!!接粉~~
------解决方案--------------------
好乱,没找到commit
------解决方案--------------------

------解决方案--------------------
jf