mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 09:05:21 +00:00
HHH-2403 - Test cleanup
(cherry picked from commit 35bd192556ba9318a96f9374a2dfb1557e5a1fb2)
This commit is contained in:
parent
cde3d876d8
commit
8d82be8d30
@ -24,6 +24,9 @@
|
||||
package org.hibernate.test.fileimport;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@ -32,6 +35,8 @@
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.hibernate.testing.AfterClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
@ -83,4 +88,27 @@ public void testImportFile() throws Exception {
|
||||
tx.commit();
|
||||
s.close();
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user