Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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

JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "exceptions on commit" Watch "exceptions on commit" New topic

exceptions on commit

Wendy Gibbons

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,


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

Joined: Oct 21, 2008
Posts: 1107

thanks, i will update everything (not very big yet)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: exceptions on commit
jQuery in Action, 3rd edition