HHH-18003 - Create a PersistenceUnitDescriptor wrapper around JPA 3.2 PersistenceConfiguration

This commit is contained in:
Steve Ebersole 2024-04-27 14:48:18 -05:00
parent c9ad1aee4b
commit a13d6a385f
1 changed files with 3 additions and 3 deletions

View File

@ -23,13 +23,13 @@ public class PersistenceConfigurationTests {
@Test
void test1() {
final PersistenceConfiguration configuration = new PersistenceConfiguration( "tst1" )
.property( SchemaToolingSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, Action.CREATE );
for ( Class<?> annotatedClass : StandardDomainModel.RETAIL.getDescriptor().getAnnotatedClasses() ) {
.property( SchemaToolingSettings.JAKARTA_HBM2DDL_DATABASE_ACTION, Action.CREATE_DROP );
for ( Class<?> annotatedClass : StandardDomainModel.CONTACTS.getDescriptor().getAnnotatedClasses() ) {
configuration.managedClass( annotatedClass );
}
try (EntityManagerFactory entityManagerFactory = new HibernatePersistenceProvider().createEntityManagerFactory( configuration )) {
entityManagerFactory.runInTransaction( entityManager -> {
entityManager.createQuery( "from Order" ).getResultList();
entityManager.createQuery( "from Contact" ).getResultList();
} );
}
}