How to debug BatchUpdateException

In order to work efficiency against database we aggregate some statements together in a batch and run them all together. This save db roundtrips  However when there is an error in one of the statement its difficult to figure out what is the root cause, since we will get a fog error like this:

Caused by: java.sql.BatchUpdateException: failed batch

In order to find the problematic statement you should change the jdbc batch property to 0, so jdbc will run each statement individually.

If you use hibernate set "hibernate.jdbc.batch_size" to 0.


אין תגובות:

פרסום תגובה