首页 > 学院 > 开发设计 > 正文

EntityListIterator 必须在tranction 中

2019-11-06 08:15:54
字体:
来源:转载
供稿:网友

其他地方没有遇到过这个问题,多线程中遇到了。 所以我加了tranction ,这里有疑惑:为什么其他地方不加可以,在单开一个县城就必须包含在事务中 可能的 原因,主线程的其他地方开启了事物。

代码`EntityListIterator eli = null; boolean beganTransaction = false; try { beganTransaction=TransactionUtil.begin(); EntityFindOptions findOptions = new EntityFindOptions(); findOptions.setDistinct(true); eli = delegator.findListIteratorByCondition(dynamicView,EntityCondition.makeCondition(con, EntityOperator.AND), null, fieldToSelect, null, findOptions); List orderList = eli.getCompleteList(); if (orderList != null) { result = orderList; }

} catch (GenericEntityException e1) { // TODO Auto-generated catch block e1.PRintStackTrace(); }finally{ if(eli!=null){ try { eli.close(); } catch (GenericEntityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { TransactionUtil.commit(beganTransaction); } catch (GenericTransactionException e) { // TODO Auto-generated catch block e.printStackTrace(); } }`
上一篇:Jva substring

下一篇:SpringMVC整合Shiro

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表