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
|
@Override
|
||||||
public Object perform() {
|
public Object perform() {
|
||||||
final Configuration hibernateConfiguration = buildHibernateConfiguration( serviceRegistry );
|
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 );
|
JpaSchemaGenerator.performGeneration( hibernateConfiguration, serviceRegistry );
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -838,7 +849,6 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
|
||||||
@Override
|
@Override
|
||||||
public EntityManagerFactoryImpl perform() {
|
public EntityManagerFactoryImpl perform() {
|
||||||
hibernateConfiguration = buildHibernateConfiguration( serviceRegistry );
|
hibernateConfiguration = buildHibernateConfiguration( serviceRegistry );
|
||||||
JpaSchemaGenerator.performGeneration( hibernateConfiguration, serviceRegistry );
|
|
||||||
|
|
||||||
SessionFactoryImplementor sessionFactory;
|
SessionFactoryImplementor sessionFactory;
|
||||||
try {
|
try {
|
||||||
|
@ -847,6 +857,9 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
|
||||||
catch (MappingException e) {
|
catch (MappingException e) {
|
||||||
throw persistenceException( "Unable to build Hibernate SessionFactory", 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 ) {
|
if ( suppliedSessionFactoryObserver != null ) {
|
||||||
sessionFactory.addObserver( suppliedSessionFactoryObserver );
|
sessionFactory.addObserver( suppliedSessionFactoryObserver );
|
||||||
|
|
Loading…
Reference in New Issue