HHH-8284 build SessionFactory before JPASchemaGenerator use to kick off
integrators
This commit is contained in:
parent
6963dc88d0
commit
a5705e011e
|
@ -812,7 +812,18 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
|
|||
@Override
|
||||
public Object perform() {
|
||||
final Configuration hibernateConfiguration = buildHibernateConfiguration( serviceRegistry );
|
||||
|
||||
// This seems overkill, but building the SF is necessary to get the Integrators to kick in.
|
||||
// Metamodel will clean this up...
|
||||
try {
|
||||
hibernateConfiguration.buildSessionFactory( serviceRegistry );
|
||||
}
|
||||
catch (MappingException e) {
|
||||
throw persistenceException( "Unable to build Hibernate SessionFactory", e );
|
||||
}
|
||||
|
||||
JpaSchemaGenerator.performGeneration( hibernateConfiguration, serviceRegistry );
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -838,7 +849,6 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
|
|||
@Override
|
||||
public EntityManagerFactoryImpl perform() {
|
||||
hibernateConfiguration = buildHibernateConfiguration( serviceRegistry );
|
||||
JpaSchemaGenerator.performGeneration( hibernateConfiguration, serviceRegistry );
|
||||
|
||||
SessionFactoryImplementor sessionFactory;
|
||||
try {
|
||||
|
@ -847,6 +857,9 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
|
|||
catch (MappingException e) {
|
||||
throw persistenceException( "Unable to build Hibernate SessionFactory", e );
|
||||
}
|
||||
|
||||
// must do after buildSessionFactory to let the Integrators kick in
|
||||
JpaSchemaGenerator.performGeneration( hibernateConfiguration, serviceRegistry );
|
||||
|
||||
if ( suppliedSessionFactoryObserver != null ) {
|
||||
sessionFactory.addObserver( suppliedSessionFactoryObserver );
|
||||
|
|
Loading…
Reference in New Issue