Search in sources :

Example 1 with TemporaryTable

use of org.hibernate.dialect.temptable.TemporaryTable in project hibernate-orm by hibernate.

the class PersistentTableStrategy method release.

public void release(SessionFactoryImplementor sessionFactory, JdbcConnectionAccess connectionAccess) {
    if (released) {
        return;
    }
    released = true;
    if (created) {
        return;
    }
    final TemporaryTable temporaryTable = getTemporaryTable();
    log.debugf("Dropping persistent ID table : %s", temporaryTable.getTableExpression());
    final TemporaryTableHelper.TemporaryTableDropWork temporaryTableDropWork = new TemporaryTableHelper.TemporaryTableDropWork(temporaryTable, sessionFactory);
    Connection connection;
    try {
        connection = connectionAccess.obtainConnection();
    } catch (UnsupportedOperationException e) {
        // assume this comes from org.hibernate.engine.jdbc.connections.internal.UserSuppliedConnectionProviderImpl
        log.debugf("Unable to obtain JDBC connection; unable to drop persistent ID table : %s", temporaryTable.getTableExpression());
        return;
    } catch (SQLException e) {
        log.error("Unable obtain JDBC Connection", e);
        return;
    }
    try {
        temporaryTableDropWork.execute(connection);
    } finally {
        try {
            connectionAccess.releaseConnection(connection);
        } catch (SQLException ignore) {
        }
    }
}
Also used : SQLException(java.sql.SQLException) TemporaryTable(org.hibernate.dialect.temptable.TemporaryTable) TemporaryTableHelper(org.hibernate.dialect.temptable.TemporaryTableHelper) Connection(java.sql.Connection)

Aggregations

Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 TemporaryTable (org.hibernate.dialect.temptable.TemporaryTable)1 TemporaryTableHelper (org.hibernate.dialect.temptable.TemporaryTableHelper)1