File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes exceptions on commit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "exceptions on commit" Watch "exceptions on commit" New topic
Author

exceptions on commit

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

if the commit throws an exception do you need to do a manual rollback to close the transaction



or will the rollback the commit does internally do that for me?
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
Commit will automatically rollback the database transaction if the commit fails.

You could is not quite right though, you should have a return or something after the rollback, otherwise you are trying to commit the transaction that was rolledback.
Normally the try/catch the commit is inside the try,

i.e.


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

thanks, i will update everything (not very big yet)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exceptions on commit