HHH-18003 - Create a PersistenceUnitDescriptor wrapper around JPA 3.2 PersistenceConfiguration
This commit is contained in:
parent
c9ad1aee4b
commit
a13d6a385f
|
@ -23,13 +23,13 @@ public class PersistenceConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
void test1() {
|
void test1() {
|
||||||
final PersistenceConfiguration configuration = new PersistenceConfiguration( "tst1" )
|
final PersistenceConfiguration configuration = new PersistenceConfiguration( "tst1" )
|
||||||
.property( SchemaToolingSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, Action.CREATE );
|
.property( SchemaToolingSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, Action.CREATE_DROP );
|
||||||
for ( Class<?> annotatedClass : StandardDomainModel.RETAIL.getDescriptor().getAnnotatedClasses() ) {
|
for ( Class<?> annotatedClass : StandardDomainModel.CONTACTS.getDescriptor().getAnnotatedClasses() ) {
|
||||||
configuration.managedClass( annotatedClass );
|
configuration.managedClass( annotatedClass );
|
||||||
}
|
}
|
||||||
try (EntityManagerFactory entityManagerFactory = new HibernatePersistenceProvider().createEntityManagerFactory( configuration )) {
|
try (EntityManagerFactory entityManagerFactory = new HibernatePersistenceProvider().createEntityManagerFactory( configuration )) {
|
||||||
entityManagerFactory.runInTransaction( entityManager -> {
|
entityManagerFactory.runInTransaction( entityManager -> {
|
||||||
entityManager.createQuery( "from Order" ).getResultList();
|
entityManager.createQuery( "from Contact" ).getResultList();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue