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即可。
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即可。
相关文章推荐
- No transactional EntityManager available; nested exception is javax.persistence.TransactionRequiredException: No transactional EntityManager available
- javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available..
- javax.persistence.TransactionRequiredException: No transactional EntityManager available
- javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available f
- javax.persistence.TransactionRequiredException: Executing an update/delete query
- javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
- javax.persistence.TransactionRequiredException: Executing an update/delete query
- javax.persistence.TransactionRequiredException: Executing an update/delete query
- javax.persistence.TransactionRequiredException: Executing an update/delete query
- 关于no transaction is in progress错误的解决方法
- javax.persistence.TransactionRequiredException: Executing an update/delete query
- javax.persistence.TransactionRequiredException: Executing an update/delete query异常
- 解决javax.persistence.TransactionRequiredException: Executing an update/delete query错误
- Could not commit JPA transaction; nested exception is javax.persistence.RollbackException 解决方法
- no transaction is in progress
- nested exception is javax.persistence.RollbackException: Error while commiting the transaction
- javax.persistence.TransactionRequiredException: Executing an update/delete query
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property
- org.apache.ibatis.reflection.ReflectionException:There is no getter for property named 'parentId' in
- javax.naming.NameNotFoundException: Name jdbc is not bound in this Context