|
10 | 10 | import jakarta.persistence.Id;
|
11 | 11 | import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
12 | 12 | import org.hibernate.cfg.AvailableSettings;
|
| 13 | +import org.hibernate.cfg.SchemaToolingSettings; |
13 | 14 | import org.hibernate.dialect.H2Dialect;
|
14 | 15 | import org.hibernate.engine.jdbc.connections.internal.DataSourceConnectionProvider;
|
15 | 16 | import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
|
|
22 | 23 | import org.hibernate.testing.orm.junit.ServiceRegistry;
|
23 | 24 | import org.hibernate.testing.orm.junit.SessionFactory;
|
24 | 25 | import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
| 26 | +import org.hibernate.testing.orm.junit.Setting; |
25 | 27 | import org.junit.jupiter.api.AfterAll;
|
26 | 28 | import org.junit.jupiter.api.Test;
|
27 | 29 |
|
|
77 | 79 | @RequiresDialect(H2Dialect.class)
|
78 | 80 | @SessionFactory
|
79 | 81 | @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) |
81 | 87 | @Jira("https://hibernate.atlassian.net/browse/HHH-18325")
|
82 | 88 | class LeakingStatementCachingTest {
|
83 | 89 |
|
84 | 90 | private static final SingleConnectionDataSource SINGLE_CONNECTION_DATASOURCE = new SingleConnectionDataSource();
|
85 | 91 |
|
86 | 92 | @AfterAll
|
87 | 93 | public void tearDown(SessionFactoryScope scope) {
|
| 94 | + scope.getSessionFactory().getSchemaManager().truncateMappedObjects(); |
88 | 95 | SINGLE_CONNECTION_DATASOURCE.close();
|
89 | 96 | }
|
90 | 97 |
|
|
0 commit comments