Skip to content

Commit 3614369

Browse files
committed
Consistent use of AvailableSettings instead of Environment
Issue: SPR-14548
1 parent d69afaa commit 3614369

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBuilder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
4343
import org.hibernate.cfg.AvailableSettings;
4444
import org.hibernate.cfg.Configuration;
45-
import org.hibernate.cfg.Environment;
4645
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
4746
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
4847
import org.hibernate.engine.spi.SessionFactoryImplementor;
@@ -138,9 +137,9 @@ public LocalSessionFactoryBuilder(DataSource dataSource, ResourceLoader resource
138137
public LocalSessionFactoryBuilder(DataSource dataSource, ResourceLoader resourceLoader, MetadataSources metadataSources) {
139138
super(metadataSources);
140139

141-
getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
140+
getProperties().put(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
142141
if (dataSource != null) {
143-
getProperties().put(Environment.DATASOURCE, dataSource);
142+
getProperties().put(AvailableSettings.DATASOURCE, dataSource);
144143
}
145144

146145
// Hibernate 5.1/5.2: manually enforce connection release mode ON_CLOSE (the former default)

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import javax.persistence.spi.PersistenceProvider;
2424

2525
import org.hibernate.cfg.AvailableSettings;
26-
import org.hibernate.cfg.Environment;
2726
import org.hibernate.dialect.DB2Dialect;
2827
import org.hibernate.dialect.DerbyTenSevenDialect;
2928
import org.hibernate.dialect.H2Dialect;
@@ -108,20 +107,20 @@ public Map<String, Object> getJpaPropertyMap() {
108107
Map<String, Object> jpaProperties = new HashMap<>();
109108

110109
if (getDatabasePlatform() != null) {
111-
jpaProperties.put(Environment.DIALECT, getDatabasePlatform());
110+
jpaProperties.put(AvailableSettings.DIALECT, getDatabasePlatform());
112111
}
113112
else if (getDatabase() != null) {
114113
Class<?> databaseDialectClass = determineDatabaseDialectClass(getDatabase());
115114
if (databaseDialectClass != null) {
116-
jpaProperties.put(Environment.DIALECT, databaseDialectClass.getName());
115+
jpaProperties.put(AvailableSettings.DIALECT, databaseDialectClass.getName());
117116
}
118117
}
119118

120119
if (isGenerateDdl()) {
121-
jpaProperties.put(Environment.HBM2DDL_AUTO, "update");
120+
jpaProperties.put(AvailableSettings.HBM2DDL_AUTO, "update");
122121
}
123122
if (isShowSql()) {
124-
jpaProperties.put(Environment.SHOW_SQL, "true");
123+
jpaProperties.put(AvailableSettings.SHOW_SQL, "true");
125124
}
126125

127126
if (this.jpaDialect.prepareConnection) {

0 commit comments

Comments
 (0)