org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Application.java    From spring-boot-multi-tenancy with MIT License 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder factory, DataSource dataSource, JpaProperties properties) {
  HibernateSettings settings = new HibernateSettings();
  settings.ddlAuto("create-drop");
  Map<String, Object> jpaProperties = new HashMap<>(properties.getHibernateProperties(settings));
  jpaProperties.put("hibernate.ejb.interceptor", hibernateInterceptor());
  return factory.dataSource(dataSource).packages("com.example").properties(jpaProperties).build();
}
 
Example #2
Source File: EntityManagerFactoryServiceImpl.java    From multitenant with Apache License 2.0 5 votes vote down vote up
protected Map<String, Object> getVendorProperties(DataSource dataSource) {
	String defaultDdlMode = this.defaultDdlAutoProvider
			.getDefaultDdlAuto(dataSource);
	Map<String, Object> vendorProperties = new LinkedHashMap<String, Object>();
	vendorProperties.putAll(this.properties.getHibernateProperties(new HibernateSettings().ddlAuto(defaultDdlMode)
			.implicitNamingStrategy(this.implicitNamingStrategy)
			.physicalNamingStrategy(this.physicalNamingStrategy)
			.hibernatePropertiesCustomizers(
					this.hibernatePropertiesCustomizers)));
	return vendorProperties;
}
 
Example #3
Source File: LocJpaConfiguration.java    From loc-framework with MIT License 5 votes vote down vote up
protected Map<String, Object> getVendorProperties() {
  String defaultDdlMode = "none";
  LinkedList<HibernatePropertiesCustomizer> customizers = new LinkedList<>();
  if (hibernatePropertiesCustomizers != null) {
    customizers.addAll(hibernatePropertiesCustomizers);
  }
  customizers.addFirst(new LocJpaConfiguration.NamingStrategiesHibernatePropertiesCustomizer(
      physicalNamingStrategy, implicitNamingStrategy));
  return new LinkedHashMap<>(hibernateProperties
      .determineHibernateProperties(jpaProperties.getProperties(),
          new HibernateSettings().ddlAuto(() -> defaultDdlMode)
              .hibernatePropertiesCustomizers(customizers)));
}