diff --git a/src/main/java/demo/customer/CustomerConfig.java b/src/main/java/demo/customer/CustomerConfig.java index e70f895..812dac9 100644 --- a/src/main/java/demo/customer/CustomerConfig.java +++ b/src/main/java/demo/customer/CustomerConfig.java @@ -7,7 +7,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryBuilder; -import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -33,12 +32,11 @@ public DataSource customerDataSource() { @Bean public LocalContainerEntityManagerFactoryBean customerEntityManager( - EntityManagerFactoryBuilder builder, JpaProperties jpaProperties) { + EntityManagerFactoryBuilder builder) { return builder .dataSource(customerDataSource()) .packages(Customer.class) .persistenceUnit("customers") - .properties(jpaProperties.getHibernateProperties(customerDataSource())) .build(); } diff --git a/src/main/java/demo/order/OrderConfig.java b/src/main/java/demo/order/OrderConfig.java index c5446b8..2a5747d 100644 --- a/src/main/java/demo/order/OrderConfig.java +++ b/src/main/java/demo/order/OrderConfig.java @@ -7,7 +7,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryBuilder; -import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -30,12 +29,11 @@ public DataSource orderDataSource() { @Bean public LocalContainerEntityManagerFactoryBean orderEntityManager( - EntityManagerFactoryBuilder builder, JpaProperties jpaProperties) { + EntityManagerFactoryBuilder builder) { return builder .dataSource(orderDataSource()) .packages(Order.class) .persistenceUnit("orders") - .properties(jpaProperties.getHibernateProperties(orderDataSource())) .build(); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 95c2686..d11dcd3 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,3 +1,5 @@ +spring.jpa.properties.hibernate.hbm2ddl.auto=create + app.customer.datasource.url=jdbc:h2:mem:customers;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE app.customer.datasource.driver-class-name=org.h2.Driver