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) {
}
}
}
Aggregations