Proper handling of database-related exceptions

This is the issue that I keep running into on various projects, so even if it seems obvious I think it is worth spending a post on it.

Some OR mapping frameworks tend to use batch update operations when dealing with the database. The “problem” that this approach introduces is that if any problem occurs during the update, a java.sql.BatchUpdateException exception will be thrown instead of the regular java.sql.SQLException. If we don’t handle BatchUpdateException properly the message it will give us will not be very useful.

continue reading on onJava

Leave a comment

Your email address will not be published. Required fields are marked *