I want to mark CMT for rollback in case of business exception.
Since we are not using EJB, sessionContext is not available to me.
Not sure how I could mark setRollBackOnly.
But that's not working. Seems that I could not use EntityTransaction in case of CMT.
Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Pinned topic How to mark setRollBackOnly in case of OpenJPA CMT on WAS 7
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-09-10T18:17:11Z at 2012-09-10T18:17:11Z by manishpoddar
leealber 1100005V7019 Posts
Re: How to mark setRollBackOnly in case of OpenJPA CMT on WAS 72012-09-07T15:56:42ZThis is the accepted answer. This is the accepted answer.I am curious how is your application take part in a CMT? Can you provide more details on this aspect?
- Assuming it is a JEE application,
- As mentioned, you are not using EJB; what type of component are you using? servlet, JSP ?
- What is the application call path looks like and how is the application interact with JPA?
Re: How to mark setRollBackOnly in case of OpenJPA CMT on WAS 72012-09-07T17:29:50ZThis is the accepted answer. This is the accepted answer.We are using WESB, Mediation will invoke DAO (plain java). In DAO we are using entityManager.joinTransaction().
We had implemented transaction management at services (web services) level. However want to mark transaction for rollback in case of exception.
Re: How to mark setRollBackOnly in case of OpenJPA CMT on WAS 72012-09-10T18:17:11ZThis is the accepted answer. This is the accepted answer.I had used following code to set rollbackonly for CMT and it work!
final InitialContext initialContext = new InitialContext();
final UOWSynchronizationRegistry uowSyncRegistry =