Merge pull request #209 from hapifhir/jpa.properties-always-overridden
Jpa.properties always overridden
This commit is contained in:
@@ -18,27 +18,27 @@ public class EnvironmentHelper {
|
|||||||
public static Properties getHibernateProperties(ConfigurableEnvironment environment) {
|
public static Properties getHibernateProperties(ConfigurableEnvironment environment) {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
|
||||||
if (environment.getProperty("spring.jpa.properties", String.class) == null) {
|
Map<String, Object> jpaProps = getPropertiesStartingWith(environment, "spring.jpa.properties");
|
||||||
properties.put("hibernate.search.model_mapping", "ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory");
|
|
||||||
properties.put("hibernate.format_sql", "false");
|
properties.putIfAbsent("hibernate.search.model_mapping", "ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory");
|
||||||
properties.put("hibernate.show_sql", "false");
|
properties.putIfAbsent("hibernate.format_sql", "false");
|
||||||
properties.put("hibernate.hbm2ddl.auto", "update");
|
properties.putIfAbsent("hibernate.show_sql", "false");
|
||||||
properties.put("hibernate.jdbc.batch_size", "20");
|
properties.putIfAbsent("hibernate.hbm2ddl.auto", "update");
|
||||||
properties.put("hibernate.cache.use_query_cache", "false");
|
properties.putIfAbsent("hibernate.jdbc.batch_size", "20");
|
||||||
properties.put("hibernate.cache.use_second_level_cache", "false");
|
properties.putIfAbsent("hibernate.cache.use_query_cache", "false");
|
||||||
properties.put("hibernate.cache.use_structured_entries", "false");
|
properties.putIfAbsent("hibernate.cache.use_second_level_cache", "false");
|
||||||
properties.put("hibernate.cache.use_minimal_puts", "false");
|
properties.putIfAbsent("hibernate.cache.use_structured_entries", "false");
|
||||||
properties.put("hibernate.search.default.directory_provider", "filesystem");
|
properties.putIfAbsent("hibernate.cache.use_minimal_puts", "false");
|
||||||
properties.put("hibernate.search.default.indexBase", "target/lucenefiles");
|
properties.putIfAbsent("hibernate.search.default.directory_provider", "filesystem");
|
||||||
properties.put("hibernate.search.lucene_version", "LUCENE_CURRENT");
|
properties.putIfAbsent("hibernate.search.default.indexBase", "target/lucenefiles");
|
||||||
} else {
|
properties.putIfAbsent("hibernate.search.lucene_version", "LUCENE_CURRENT");
|
||||||
Arrays.asList(environment.getProperty("spring.jpa.properties", String.class).split(" ")).stream().forEach(s ->
|
|
||||||
{
|
for (Map.Entry<String, Object> entry : jpaProps.entrySet()) {
|
||||||
String[] values = s.split("=");
|
String strippedKey = entry.getKey().replace("spring.jpa.properties.", "");
|
||||||
properties.put(values[0], values[1]);
|
properties.put(strippedKey, entry.getValue().toString());
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (environment.getProperty("elasticsearch.enabled", Boolean.class) != null
|
if (environment.getProperty("elasticsearch.enabled", Boolean.class) != null
|
||||||
&& environment.getProperty("elasticsearch.enabled", Boolean.class) == true) {
|
&& environment.getProperty("elasticsearch.enabled", Boolean.class) == true) {
|
||||||
ElasticsearchHibernatePropertiesBuilder builder = new ElasticsearchHibernatePropertiesBuilder();
|
ElasticsearchHibernatePropertiesBuilder builder = new ElasticsearchHibernatePropertiesBuilder();
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ spring:
|
|||||||
password: null
|
password: null
|
||||||
driverClassName: org.h2.Driver
|
driverClassName: org.h2.Driver
|
||||||
max-active: 15
|
max-active: 15
|
||||||
# jpa:
|
jpa:
|
||||||
# properties:
|
properties:
|
||||||
# hibernate.dialect: org.hibernate.dialect.h2dialect
|
# hibernate.dialect: org.hibernate.dialect.h2dialect
|
||||||
# hibernate.search.model_mapping: ca.uhn.fhir.jpa.search.lucenesearchmappingfactory
|
# hibernate.search.model_mapping: ca.uhn.fhir.jpa.search.lucenesearchmappingfactory
|
||||||
# hibernate.format_sql: false
|
# hibernate.format_sql: false
|
||||||
|
|||||||
Reference in New Issue
Block a user