Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hibernate temp_use_jdbc_metadata_defaults = false everywhere #641

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void configureSources(MetadataSources sources) throws DatabaseExceptio
Configuration config = new Configuration(sources);
config.configure(getHibernateConnection().getPath());

config.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
config.setProperty(HibernateDatabase.HIBERNATE_TEMP_USE_JDBC_METADATA_DEFAULTS, Boolean.FALSE.toString());
config.setProperty("hibernate.cache.use_second_level_cache", "false");

ServiceRegistry standardRegistry = configuration.getStandardServiceRegistryBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public abstract class HibernateDatabase extends AbstractJdbcDatabase {

private boolean indexesForForeignKeys = false;
public static final String DEFAULT_SCHEMA = "HIBERNATE";
public static final String HIBERNATE_TEMP_USE_JDBC_METADATA_DEFAULTS = "hibernate.temp.use_jdbc_metadata_defaults";

public HibernateDatabase() {
setDefaultCatalogName(DEFAULT_SCHEMA);
Expand Down Expand Up @@ -186,6 +187,7 @@ protected MetadataSources createMetadataSources() throws DatabaseException {

ServiceRegistry standardRegistry = new StandardServiceRegistryBuilder()
.applySetting(AvailableSettings.DIALECT, dialect)
.applySetting(HibernateDatabase.HIBERNATE_TEMP_USE_JDBC_METADATA_DEFAULTS, Boolean.FALSE.toString())
.addService(ConnectionProvider.class, new NoOpConnectionProvider())
.addService(MultiTenantConnectionProvider.class, new NoOpConnectionProvider())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ protected EntityManagerFactoryBuilderImpl createEntityManagerFactoryBuilder() {
MyHibernatePersistenceProvider persistenceProvider = new MyHibernatePersistenceProvider();

Map<String, Object> properties = new HashMap<>();
properties.put(HibernateDatabase.HIBERNATE_TEMP_USE_JDBC_METADATA_DEFAULTS, Boolean.FALSE.toString());
properties.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, Boolean.FALSE.toString());
properties.put(AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA, getProperty(AvailableSettings.USE_NATIONALIZED_CHARACTER_DATA));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ protected EntityManagerFactoryBuilderImpl createEntityManagerFactoryBuilder() {

Map<String, String> map = new HashMap<>();
map.put(AvailableSettings.DIALECT, getProperty(AvailableSettings.DIALECT));
map.put(HibernateDatabase.HIBERNATE_TEMP_USE_JDBC_METADATA_DEFAULTS, Boolean.FALSE.toString());
map.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, Boolean.FALSE.toString());
map.put(AvailableSettings.PHYSICAL_NAMING_STRATEGY, getHibernateConnection().getProperties().getProperty(AvailableSettings.PHYSICAL_NAMING_STRATEGY));
map.put(AvailableSettings.IMPLICIT_NAMING_STRATEGY, getHibernateConnection().getProperties().getProperty(AvailableSettings.IMPLICIT_NAMING_STRATEGY));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package liquibase.ext.hibernate.database;

import java.util.Collections;
import java.util.Map;

import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
import org.hibernate.jpa.boot.spi.Bootstrap;
Expand Down Expand Up @@ -50,7 +50,8 @@ protected EntityManagerFactoryBuilderImpl createEntityManagerFactoryBuilder() {
internalPersistenceUnitManager.preparePersistenceUnitInfos();
PersistenceUnitInfo persistenceUnitInfo = internalPersistenceUnitManager.obtainDefaultPersistenceUnitInfo();

EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(persistenceUnitInfo, Collections.emptyMap());
EntityManagerFactoryBuilderImpl builder = (EntityManagerFactoryBuilderImpl) Bootstrap.getEntityManagerFactoryBuilder(persistenceUnitInfo, Map.of(
HibernateDatabase.HIBERNATE_TEMP_USE_JDBC_METADATA_DEFAULTS, Boolean.FALSE.toString()));
return builder;
}

Expand Down
Loading