Consistent use of AvailableSettings instead of Environment
Issue: SPR-14548
This commit is contained in:
parent
d69afaada8
commit
36143692ac
|
@ -42,7 +42,6 @@ import org.hibernate.boot.MetadataSources;
|
|||
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
|
@ -138,9 +137,9 @@ public class LocalSessionFactoryBuilder extends Configuration {
|
|||
public LocalSessionFactoryBuilder(DataSource dataSource, ResourceLoader resourceLoader, MetadataSources metadataSources) {
|
||||
super(metadataSources);
|
||||
|
||||
getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
|
||||
getProperties().put(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
|
||||
if (dataSource != null) {
|
||||
getProperties().put(Environment.DATASOURCE, dataSource);
|
||||
getProperties().put(AvailableSettings.DATASOURCE, dataSource);
|
||||
}
|
||||
|
||||
// Hibernate 5.1/5.2: manually enforce connection release mode ON_CLOSE (the former default)
|
||||
|
|
|
@ -23,7 +23,6 @@ import javax.persistence.EntityManagerFactory;
|
|||
import javax.persistence.spi.PersistenceProvider;
|
||||
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.DB2Dialect;
|
||||
import org.hibernate.dialect.DerbyTenSevenDialect;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
|
@ -108,20 +107,20 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
|||
Map<String, Object> jpaProperties = new HashMap<>();
|
||||
|
||||
if (getDatabasePlatform() != null) {
|
||||
jpaProperties.put(Environment.DIALECT, getDatabasePlatform());
|
||||
jpaProperties.put(AvailableSettings.DIALECT, getDatabasePlatform());
|
||||
}
|
||||
else if (getDatabase() != null) {
|
||||
Class<?> databaseDialectClass = determineDatabaseDialectClass(getDatabase());
|
||||
if (databaseDialectClass != null) {
|
||||
jpaProperties.put(Environment.DIALECT, databaseDialectClass.getName());
|
||||
jpaProperties.put(AvailableSettings.DIALECT, databaseDialectClass.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (isGenerateDdl()) {
|
||||
jpaProperties.put(Environment.HBM2DDL_AUTO, "update");
|
||||
jpaProperties.put(AvailableSettings.HBM2DDL_AUTO, "update");
|
||||
}
|
||||
if (isShowSql()) {
|
||||
jpaProperties.put(Environment.SHOW_SQL, "true");
|
||||
jpaProperties.put(AvailableSettings.SHOW_SQL, "true");
|
||||
}
|
||||
|
||||
if (this.jpaDialect.prepareConnection) {
|
||||
|
|
Loading…
Reference in New Issue