Merge branch 'master' into rel_5_3_0
This commit is contained in:
@@ -26,33 +26,28 @@ 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.format_sql", "false");
|
properties.putIfAbsent("hibernate.format_sql", "false");
|
||||||
properties.put("hibernate.show_sql", "false");
|
properties.putIfAbsent("hibernate.show_sql", "false");
|
||||||
properties.put("hibernate.hbm2ddl.auto", "update");
|
properties.putIfAbsent("hibernate.hbm2ddl.auto", "update");
|
||||||
properties.put("hibernate.jdbc.batch_size", "20");
|
properties.putIfAbsent("hibernate.jdbc.batch_size", "20");
|
||||||
properties.put("hibernate.cache.use_query_cache", "false");
|
properties.putIfAbsent("hibernate.cache.use_query_cache", "false");
|
||||||
properties.put("hibernate.cache.use_second_level_cache", "false");
|
properties.putIfAbsent("hibernate.cache.use_second_level_cache", "false");
|
||||||
properties.put("hibernate.cache.use_structured_entries", "false");
|
properties.putIfAbsent("hibernate.cache.use_structured_entries", "false");
|
||||||
properties.put("hibernate.cache.use_minimal_puts", "false");
|
properties.putIfAbsent("hibernate.cache.use_minimal_puts", "false");
|
||||||
|
|
||||||
properties.put(BackendSettings.backendKey(LuceneIndexSettings.DIRECTORY_TYPE), "local-filesystem");
|
properties.putIfAbsent(BackendSettings.backendKey(LuceneIndexSettings.DIRECTORY_TYPE), "local-filesystem");
|
||||||
properties.put(BackendSettings.backendKey(LuceneIndexSettings.DIRECTORY_ROOT), "target/lucenefiles");
|
properties.putIfAbsent(BackendSettings.backendKey(LuceneIndexSettings.DIRECTORY_ROOT), "target/lucenefiles");
|
||||||
properties.put(BackendSettings.backendKey(BackendSettings.TYPE), "lucene");
|
properties.putIfAbsent(BackendSettings.backendKey(BackendSettings.TYPE), "lucene");
|
||||||
properties.put(BackendSettings.backendKey(LuceneBackendSettings.ANALYSIS_CONFIGURER), HapiLuceneAnalysisConfigurer.class.getName());
|
properties.putIfAbsent(BackendSettings.backendKey(LuceneBackendSettings.ANALYSIS_CONFIGURER), HapiLuceneAnalysisConfigurer.class.getName());
|
||||||
properties.put(BackendSettings.backendKey(LuceneBackendSettings.LUCENE_VERSION), "LUCENE_CURRENT");
|
properties.putIfAbsent(BackendSettings.backendKey(LuceneBackendSettings.LUCENE_VERSION), "LUCENE_CURRENT");
|
||||||
|
|
||||||
//Set this value to true in the properties to enable lucene.
|
for (Map.Entry<String, Object> entry : jpaProps.entrySet()) {
|
||||||
properties.put(HibernateOrmMapperSettings.ENABLED, environment.getProperty("spring.jpa.properties.hibernate.search.enabled", "false"));
|
String strippedKey = entry.getKey().replace("spring.jpa.properties.", "");
|
||||||
|
properties.put(strippedKey, entry.getValue().toString());
|
||||||
} else {
|
|
||||||
Arrays.asList(environment.getProperty("spring.jpa.properties", String.class).split(" ")).stream().filter(s -> !StringUtils.isEmpty(s)).forEach(s ->
|
|
||||||
{
|
|
||||||
String[] values = s.split("=");
|
|
||||||
properties.put(values[0], values[1]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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