Skip to content

Commit fd48a4c

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

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 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,8 @@
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;
27+
import org.hibernate.tool.schema.spi.SchemaTruncator;
2528
import org.junit.jupiter.api.AfterAll;
2629
import org.junit.jupiter.api.Test;
2730

@@ -77,14 +80,19 @@
7780
@RequiresDialect(H2Dialect.class)
7881
@SessionFactory
7982
@DomainModel(annotatedClasses = LeakingStatementCachingTest.BaseEntity.class)
80-
@ServiceRegistry(serviceContributors = LeakingStatementCachingTest.ConnectionProviderServiceContributor.class)
83+
@ServiceRegistry(
84+
settings = {
85+
@Setting(name = SchemaToolingSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, value = "create")
86+
},
87+
serviceContributors = LeakingStatementCachingTest.ConnectionProviderServiceContributor.class)
8188
@Jira("https://hibernate.atlassian.net/browse/HHH-18325")
8289
class LeakingStatementCachingTest {
8390

8491
private static final SingleConnectionDataSource SINGLE_CONNECTION_DATASOURCE = new SingleConnectionDataSource();
8592

8693
@AfterAll
8794
public void tearDown(SessionFactoryScope scope) {
95+
scope.getSessionFactory().getSchemaManager().truncateMappedObjects();
8896
SINGLE_CONNECTION_DATASOURCE.close();
8997
}
9098

0 commit comments

Comments
 (0)