In hibernate 2.1.8 when Integrity constraint violation occurs I see this:
------------------
14:54:19.666 WARN!! [SocketListener0-2] net.sf.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:57) >30> SQL Error: -8, SQLState: 23000
14:54:19.676 ERROR! [SocketListener0-2] net.sf.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:58) >30> Integrity constraint violation FUSER_1 table: GR_USER in statement [delete from gr_prstatus where prstatus_id=?]
14:54:19.676 ERROR! [SocketListener0-2] net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2400) >23> Could not synchronize database state with session
------------------
And when I use hibernate 3.0.5 in the same situation I see:
---------------------
10:47:37,767 ERROR
org.hibernate.util.JDBCExceptionReporter:logExceptions:72 - failed batch
10:47:37,782 ERROR org.hibernate.event.def.AbstractFlushingEventListener:performExecutions:277 - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
---------------------
Why do I get GenericJDBCException instead of ConstraintViolationException ?
I need ConstraintViolationException to get name of the violated constraint.
|