I think this is a bug in {{ TemporaryTableBulkIdStrategy }} , because , when using the Oracle8iDialect says , it appears that temporary tables shouldn't be deleted:
{code:java} @Override public boolean dropTemporaryTableAfterUse() { return false; } {code}
But this check is made only when deleting the table:
{code:java} protected void releaseTempTable(Queryable persister, SessionImplementor session) { if ( session.getFactory().getDialect().dropTemporaryTableAfterUse() ) { TemporaryTableDropWork work = new TemporaryTableDropWork( persister, session ); if ( shouldIsolateTemporaryTableDDL( session ) ) { session.getTransactionCoordinator() .getTransaction() .createIsolationDelegate() .delegateWork( work, shouldTransactIsolatedTemporaryTableDDL( session ) ); } else { final Connection connection = session.getTransactionCoordinator() .getJdbcCoordinator() .getLogicalConnection() .getConnection(); work.execute( connection ); session.getTransactionCoordinator() .getJdbcCoordinator() .afterStatementExecution(); } } else { // at the very least cleanup the data :) PreparedStatement ps = null; try { final String sql = "delete from " + persister.getTemporaryIdTableName(); ps = session.getTransactionCoordinator().getJdbcCoordinator().getStatementPreparer().prepareStatement( sql, false ); session.getTransactionCoordinator().getJdbcCoordinator().getResultSetReturn().executeUpdate( ps ); } catch( Throwable t ) { log.unableToCleanupTemporaryIdTable(t); } finally { if ( ps != null ) { try { session.getTransactionCoordinator().getJdbcCoordinator().release( ps ); } catch( Throwable ignore ) { // ignore } } } } } {code}
but now when creating the table:
{code:java} // Some comments here public String getFoo() { return foo; } {code}
{code:java} protected void createTempTable(Queryable persister, SessionImplementor session) { // Don't really know all the codes required to adequately decipher returned jdbc exceptions here. // simply allow the failure to be eaten and the subsequent insert-selects/deletes should fail TemporaryTableCreationWork work = new TemporaryTableCreationWork( persister ); if ( shouldIsolateTemporaryTableDDL( session ) ) { session.getTransactionCoordinator() .getTransaction() .createIsolationDelegate() .delegateWork( work, shouldTransactIsolatedTemporaryTableDDL( session ) ); } else { final Connection connection = session.getTransactionCoordinator() .getJdbcCoordinator() .getLogicalConnection() .getConnection(); work.execute( connection ); session.getTransactionCoordinator() .getJdbcCoordinator() .afterStatementExecution(); } } {code}
As a workaround, you could extend the Oracle dialect and override the dropTemporaryTableAfterUse method to return false. |
|