I have a unique case were a database trigger is used to provide data by raising an exception. The field is an identy column they just use the trigger to grab the auto generated number. My problem is I need to allow my EJB 3 to auto generate the id and the exception is raised and the process fails.
How can I get at the exception to handle it if it is thrown in a Hibernate method call.
Here is the exception:
2005-08-18 16:13:27,625 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not insert: [gov.utah.laborcommission.safety.entities.LcEntity] [insert into ENTITY (Data_Source_ID, Creation_Date, Entity_Name, Carrier_Flag, Email_Address, Employer_Flag, Organization_Flag, Person_Flag, Property_Flag, Self_Insured_Flag) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) select @@identity] com.sybase.jdbc3.jdbc.SybSQLException: ZzZ2688411ZzZ