[英]How to roll back JTA transaction correctly?
What is the correct way of rolling back the transaction of a container managed JTA transaction? 回滚容器管理的JTA事务的事务的正确方法是什么?
I understand this: EJBException when calling entityManager.getTransaction() that I can't get the transaction instance. 我理解这一点: EJBException在调用entityManager.getTransaction()时我无法获取事务实例。 I read a solution here but I'm not sure whether this is correct.
我在这里阅读了一个解决方案,但我不确定这是否正确。
I'm also aware that, if I throw an exception, the transaction will be rolled back. 我也知道,如果我抛出异常,事务将被回滚。
But my question is: if I want to (must) use a container managed EntityManager
, what's the correct way of rolling back a transaction inside it? 但我的问题是:如果我想(必须)使用容器管理的
EntityManager
,那么在其中回滚事务的正确方法是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.