Hi, We have discovered a minor problem within JDBCtransaction.java when using Oracle RDB 7.1, the database transaction is not automatically rollbacked by the database on commit failures, the client has to send a rollback over the JDBC-connection in that case. When no rollback is sent, the database transaction will still be open and associated with a JDBC-connection when the connection is returned to the connection pool. At another time some other client transaction will get this connection from the pool with an open database transaction which then will fail. We have solved this problem by changing JDBCTransaction in this way:
private boolean rollbackAfterCommitFailed = false; public void setRollbackAfterCommitFailed(boolean rollbackAfterCommitFailed) { this.rollbackAfterCommitFailed = rollbackAfterCommitFailed; } private void commitAndResetAutoCommit() throws SQLException { try { jdbcContext.connection().commit(); } catch (SQLException e) { // Extension for Oracle-RDB: Rollback after failed Commit if (rollbackAfterCommitFailed) { try { log.error("Rollback after Commit-Failure"); jdbcContext.connection().rollback(); } catch (SQLException s) { log.error("Exception during Rollback", s); } throw e; } finally { toggleAutoCommit(); } } In the JDBCTransactionFactory we added following: private boolean rollbackCommitFailures; // Property hibernate.transaction.rollback_after_commit_failure public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) throws HibernateException { JDBCTransaction trans = new JDBCTransaction(jdbcContext, transactionContext); trans.setRollbackAfterCommitFailed(rollbackCommitFailures); return trans; } /** [EMAIL PROTECTED] */ public void configure(Properties props) throws HibernateException { rollbackCommitFailures = PropertiesHelper.getBoolean( Environment.TRANSACTION_ROLLBACK_COMMIT_FAILURES, props,false); } It would be nice to have this little problem solved in future Hibernate releases. I also really would like to see Oracle RDB in the list of supported databases, for every new Hibernate Release I have to compile/add RdbDialect.java (got it from HP/Oracle) to the jar. Regards Martin Oesterreichische Lotterien Gesellschaft m.b.H., Rennweg 44, A-1038 Wien, FN 54472 g, Handelsgericht Wien, DVR-Nr: 0476706
_______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev