Skip to content

Commit a418914

Browse files
committed
HHH-19831 - perform schema truncation manually, before the connection pool is shut down
Signed-off-by: Jan Schatteman <[email protected]>
1 parent 21b62db commit a418914

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/batch/LeakingStatementCachingTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import jakarta.persistence.Id;
1111
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
1212
import org.hibernate.cfg.AvailableSettings;
13+
import org.hibernate.cfg.SchemaToolingSettings;
1314
import org.hibernate.dialect.H2Dialect;
1415
import org.hibernate.engine.jdbc.connections.internal.DataSourceConnectionProvider;
1516
import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
@@ -22,6 +23,7 @@
2223
import org.hibernate.testing.orm.junit.ServiceRegistry;
2324
import org.hibernate.testing.orm.junit.SessionFactory;
2425
import org.hibernate.testing.orm.junit.SessionFactoryScope;
26+
import org.hibernate.testing.orm.junit.Setting;
2527
import org.junit.jupiter.api.AfterAll;
2628
import org.junit.jupiter.api.Test;
2729

@@ -77,14 +79,19 @@
7779
@RequiresDialect(H2Dialect.class)
7880
@SessionFactory
7981
@DomainModel(annotatedClasses = LeakingStatementCachingTest.BaseEntity.class)
80-
@ServiceRegistry(serviceContributors = LeakingStatementCachingTest.ConnectionProviderServiceContributor.class)
82+
@ServiceRegistry(
83+
settings = {
84+
@Setting(name = SchemaToolingSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, value = "create")
85+
},
86+
serviceContributors = LeakingStatementCachingTest.ConnectionProviderServiceContributor.class)
8187
@Jira("https://hibernate.atlassian.net/browse/HHH-18325")
8288
class LeakingStatementCachingTest {
8389

8490
private static final SingleConnectionDataSource SINGLE_CONNECTION_DATASOURCE = new SingleConnectionDataSource();
8591

8692
@AfterAll
8793
public void tearDown(SessionFactoryScope scope) {
94+
scope.getSessionFactory().getSchemaManager().truncateMappedObjects();
8895
SINGLE_CONNECTION_DATASOURCE.close();
8996
}
9097

0 commit comments

Comments
 (0)