This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes JPA UserTransaction not rolled back Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "JPA UserTransaction not rolled back" Watch "JPA UserTransaction not rolled back" New topic
Author

JPA UserTransaction not rolled back

Jochem Pim
Greenhorn

Joined: Dec 08, 2011
Posts: 6
The BMT(transaction) in the following code isn't rolled back after an exception. I use EJB 3.1 with JPA 2.0. My programs calls TaskExecutor:executeTask(Task) to begin.

As you might guess, the SomeEntity is in the database after the transaction is rolled back.
If you are interested, this is my persistence.xml:

To be complete, here is the essential part of SomeEntity:


Why is the SomeEntity in the database after the UserTransaction is rolled back?
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

This catch is not rollingback
Maybe your problem is here.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Jochem Pim
Greenhorn

Joined: Dec 08, 2011
Posts: 6
Hebert Coelho wrote:Maybe your problem is here.

The program newer reached that part of the code. The java.lang.ArithmeticException is caught in the first catch.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

What about the others: SecurityException | IllegalStateException | NotSupportedException | SystemException ex
Jochem Pim
Greenhorn

Joined: Dec 08, 2011
Posts: 6
I tested if the code reached that part and it didn't:

Jochem Pim
Greenhorn

Joined: Dec 08, 2011
Posts: 6
After some extensive research, the problem seams to be different.
I created a new post here: http://www.coderanch.com/t/561174/EJB-JEE/java/JPA-transaction-rollback-fails-call
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JPA UserTransaction not rolled back
 
Similar Threads
JTA Application Managed EntityManager question
Insert or Update (Hibernate JPA + Jboss 5.0.0GA)
Handling errors when running SQL query
JPA transaction rollback fails with call to stateless bean
ejbCreate -permitted and prohibited operations -