您的位置:首页 > 产品设计 > UI/UE

javax.persistence.TransactionRequiredException: no transaction is in progress

2013-09-12 15:22 1031 查看
(暂)通常是因为不适当的flush() 引起异常的 。。。

When persisting a transient entity during manual flush, an exception "javax.persistence.TransactionRequiredException: no transaction is in progress" is thrown, unless getEntityManager().joinTransaction() is executed prior to flush() - despite declaring the
POJO as @Transactional and using Seam-managed transactions and persistence contexts.

When persisting a managed entity, however, no exceptions are thrown and update completes normally.

解决方案:

在Dao类上添加注解@Transactional即可。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐