|
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; |
| 27 | +import org.hibernate.tool.schema.spi.SchemaTruncator; |
25 | 28 | import org.junit.jupiter.api.AfterAll; |
26 | 29 | import org.junit.jupiter.api.Test; |
27 | 30 |
|
|
77 | 80 | @RequiresDialect(H2Dialect.class) |
78 | 81 | @SessionFactory |
79 | 82 | @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) |
81 | 88 | @Jira("https://hibernate.atlassian.net/browse/HHH-18325") |
82 | 89 | class LeakingStatementCachingTest { |
83 | 90 |
|
84 | 91 | private static final SingleConnectionDataSource SINGLE_CONNECTION_DATASOURCE = new SingleConnectionDataSource(); |
85 | 92 |
|
86 | 93 | @AfterAll |
87 | 94 | public void tearDown(SessionFactoryScope scope) { |
| 95 | + scope.getSessionFactory().getSchemaManager().truncateMappedObjects(); |
88 | 96 | SINGLE_CONNECTION_DATASOURCE.close(); |
89 | 97 | } |
90 | 98 |
|
|
0 commit comments