This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
Similar Threads
JDBC Transactions across multiple databases
com.sybase.jdbc2.SybConnection: SET CHAINED command not allowed within multi-statement transaction
What does the UserTransaction.rollback() do??!!
Exception handling - regarding
java.sql.SQLException: Connection handle has been closed and is unusable