Search in sources :

Example 1 with AfterClassOnce

use of org.hibernate.testing.AfterClassOnce in project hibernate-orm by hibernate.

the class MultiLineImportFileTest method tearDown.

@AfterClassOnce
public void tearDown() {
    final Session session = openSession();
    session.getTransaction().begin();
    session.doWork(new Work() {

        @Override
        public void execute(Connection connection) throws SQLException {
            PreparedStatement statement = null;
            try {
                statement = connection.prepareStatement("DROP TABLE test_data");
                statement.execute();
            } finally {
                if (statement != null) {
                    statement.close();
                }
            }
        }
    });
    session.getTransaction().commit();
    session.close();
}
Also used : SQLException(java.sql.SQLException) Work(org.hibernate.jdbc.Work) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) Session(org.hibernate.Session) AfterClassOnce(org.hibernate.testing.AfterClassOnce)

Aggregations

Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1 Session (org.hibernate.Session)1 Work (org.hibernate.jdbc.Work)1 AfterClassOnce (org.hibernate.testing.AfterClassOnce)1