HHH-8121 - Make property-able JPA settings defined in persistence.xml available in EMF.getProperties()
This commit is contained in:
parent
076e17e5b1
commit
ea8f587800
|
@ -832,7 +832,13 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
|
|||
sessionFactory.addObserver( new ServiceRegistryCloser() );
|
||||
|
||||
// NOTE : passing cfg is temporary until
|
||||
return new EntityManagerFactoryImpl( persistenceUnit.getName(), sessionFactory, settings, configurationValues, hibernateConfiguration );
|
||||
return new EntityManagerFactoryImpl(
|
||||
persistenceUnit.getName(),
|
||||
sessionFactory,
|
||||
settings,
|
||||
configurationValues,
|
||||
hibernateConfiguration
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -906,13 +912,21 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
|
|||
|
||||
private void applyJdbcConnectionProperties() {
|
||||
if ( dataSource != null ) {
|
||||
serviceRegistryBuilder.applySetting( Environment.DATASOURCE, dataSource );
|
||||
serviceRegistryBuilder.applySetting( org.hibernate.cfg.AvailableSettings.DATASOURCE, dataSource );
|
||||
}
|
||||
else if ( persistenceUnit.getJtaDataSource() != null ) {
|
||||
serviceRegistryBuilder.applySetting( Environment.DATASOURCE, persistenceUnit.getJtaDataSource() );
|
||||
if ( ! serviceRegistryBuilder.getSettings().containsKey( org.hibernate.cfg.AvailableSettings.DATASOURCE ) ) {
|
||||
serviceRegistryBuilder.applySetting( org.hibernate.cfg.AvailableSettings.DATASOURCE, persistenceUnit.getJtaDataSource() );
|
||||
// HHH-8121 : make the PU-defined value available to EMF.getProperties()
|
||||
configurationValues.put( AvailableSettings.JTA_DATASOURCE, persistenceUnit.getJtaDataSource() );
|
||||
}
|
||||
}
|
||||
else if ( persistenceUnit.getNonJtaDataSource() != null ) {
|
||||
serviceRegistryBuilder.applySetting( Environment.DATASOURCE, persistenceUnit.getNonJtaDataSource() );
|
||||
if ( ! serviceRegistryBuilder.getSettings().containsKey( org.hibernate.cfg.AvailableSettings.DATASOURCE ) ) {
|
||||
serviceRegistryBuilder.applySetting( org.hibernate.cfg.AvailableSettings.DATASOURCE, persistenceUnit.getNonJtaDataSource() );
|
||||
// HHH-8121 : make the PU-defined value available to EMF.getProperties()
|
||||
configurationValues.put( AvailableSettings.NON_JTA_DATASOURCE, persistenceUnit.getNonJtaDataSource() );
|
||||
}
|
||||
}
|
||||
else {
|
||||
final String driver = (String) configurationValues.get( AvailableSettings.JDBC_DRIVER );
|
||||
|
|
Loading…
Reference in New Issue