diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java b/spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java index aeb4688031..1736a575ce 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java @@ -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) diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java index 44e2c225d7..b96ec6bf44 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java @@ -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 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) {