public void releaseAnyConnection(Connection connection) throws SQLException { try { connection.createStatement().execute("USE " + Constants.TENANT_SCHEMA_DEFAULT); } catch (SQLException e) { throw new HibernateException("Could not alter JDBC connection to default schema", e); } currentConnection.remove(); connectionProvider.closeConnection(connection); }
public void release() throws SQLException { // we only release the connection if (connection != null) { JDBCExceptionReporter.logAndClearWarnings(connection); if (toggleAutoCommit) { connection.setAutoCommit(false); } provider.closeConnection(connection); connection = null; } }