This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

rollback not reached?

 
Ranch Hand
Posts: 279
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers (and yes ... this is a [soon to be] deprecated exam guide),

Under what possible conditions would trans still be active if JPA implementations will automatically roll back transactions if any exception is thrown during the commit process?

MZ


JPA implementations will automatically roll back transactions if any exception is thrown during the commit process.




The EntityTransaction Interface
...
The following example illustrates the creation of an entity manager factory in a Java SE
environment, and its use in creating and using a resource-local entity manager:
...
Example. Grouping Operations with Transactions:


 
Creator of Enthuware JWS+ V6
Posts: 3294
297
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Charles,

The PersistenceException thrown by the persistence provider doesn't cause a rollback immediately. It will mark the transaction for rollback.

From JPA 2.0:

All instances of PersistenceException except for instances of NoResultException, NonUniqueResultException, LockTimeoutException, and QueryTimeoutException will cause the current transaction, if one is active, to be marked for rollback.


On particulair example for the transaction to be active (in the catch block) is when a LockTimeoutException is thrown from one of the methods in the try block.
 
Charles O'Leary
Ranch Hand
Posts: 279
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frits,
Thanks!
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!