1 Reply Latest reply on Oct 31, 2001 10:17 AM by lisa_r

    Missing  SQLException

    kjelln

      We use CMP entity beans to maintain data in an Microsoft SQL server database ( Jboss 2.2.1 and SQLServer 2000 on Windows2000 ).

      When a SQL exception occurs we would like to get the SQLState / Error number from the SQL server, but experience a problem: Jboss throws a CreateException, instead of the SQLException ( when we call the create methode on the home interface). How can we get the SQLException? We cannot find any methods on CreateException that gives us the root cause for the exception.

      We have similar problems with update and delete: When updating we get javax.transaction.RollbackException and when deleting we get javax.ejb.RemoveException.

      ( What we basically tries to achive is the following : Some of the error messages from any SQL database are related to user errors like required data that are missing and attempts to break referential integrity. Having a meckanism to pick out these in a general way have proven very valuable in previous systems that we have built.)

      Any ideas?

      TIA, Kjell.

      This is the stack trace fro create exception:

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      javax.transaction.TransactionRolledbackException: Exception when creating bean. ; nested exc
      eption is:
      java.lang.reflect.InvocationTargetException; nested exception is:
      java.rmi.RemoteException: Exception when creating bean. ; nested exception is:
      java.lang.reflect.InvocationTargetException
      javax.transaction.TransactionRolledbackException: Exception when creating bean. ; nested exception i
      s:
      java.lang.reflect.InvocationTargetException; nested exception is:
      java.rmi.RemoteException: Exception when creating bean. ; nested exception is:
      java.lang.reflect.InvocationTargetException
      java.rmi.RemoteException: Exception when creating bean. ; nested exception is:
      java.lang.reflect.InvocationTargetException
      java.lang.reflect.InvocationTargetException: javax.ejb.CreateException: Could not create entity:java
      .sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Database update aborted - Unknown error
      <<no stack trace available>>