Hi,

I have USER table which containts a column 'email' which should be unique.

When I try to write an object to the table using the ODMG api I can catch a
TransactionAbortedException. How can I get to the SQL error code?

I tried the following, which did not work:

try {
 tx.commit();
} catch (TransactionAbortedException ex1) {
 Throwable ex = ex1.getCause();
  if (ex instanceof PersistenceBrokerSQLException) {
   if (((PersistenceBrokerSQLException)ex).getSourceException() instanceof
SQLException) {
    SQLException sex1 =
     (SQLException)((PersistenceBrokerSQLException)ex).getSourceException();
    logger.info("Exception sql state: " + sex1.getSQLState() + ", " + 
     sex1.getErrorCode() + ", " + sex1.toString());
}

The sql state is null and the error code is 0. (I am using ojb 1.0RC4 and
PostgreSQL 7.3).

Best regards,
Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to