diff --git a/spring-jpa/.settings/org.eclipse.wst.common.project.facet.core.xml b/spring-jpa/.settings/org.eclipse.wst.common.project.facet.core.xml index a8a65de481..5f3c0f7702 100644 --- a/spring-jpa/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/spring-jpa/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,7 +1,8 @@ - + - + + diff --git a/spring-jpa/pom.xml b/spring-jpa/pom.xml index 9d497774ca..71dd3df270 100644 --- a/spring-jpa/pom.xml +++ b/spring-jpa/pom.xml @@ -268,7 +268,7 @@ - 4.0.4.RELEASE + 4.1.3.RELEASE 4.3.2.RELEASE 3.20.0-GA diff --git a/spring-jpa/src/main/java/org/baeldung/custom/config/PersistenceDerbyJPAConfig.java b/spring-jpa/src/main/java/org/baeldung/custom/config/PersistenceDerbyJPAConfig.java index 812709111d..6be7053b78 100644 --- a/spring-jpa/src/main/java/org/baeldung/custom/config/PersistenceDerbyJPAConfig.java +++ b/spring-jpa/src/main/java/org/baeldung/custom/config/PersistenceDerbyJPAConfig.java @@ -75,6 +75,8 @@ public class PersistenceDerbyJPAConfig { final Properties hibernateProperties = new Properties(); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache")); + hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache")); // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); return hibernateProperties; } diff --git a/spring-jpa/src/main/java/org/baeldung/user/service/MyUserService.java b/spring-jpa/src/main/java/org/baeldung/user/service/MyUserService.java index 866ac88f29..edbb1651a3 100644 --- a/spring-jpa/src/main/java/org/baeldung/user/service/MyUserService.java +++ b/spring-jpa/src/main/java/org/baeldung/user/service/MyUserService.java @@ -1,13 +1,12 @@ package org.baeldung.user.service; -import javax.transaction.Transactional; - import org.baeldung.persistence.model.MyUser; import org.baeldung.user.dao.MyUserDAO; import org.baeldung.web.MyUserDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @Transactional diff --git a/spring-jpa/src/main/resources/persistence-derby.properties b/spring-jpa/src/main/resources/persistence-derby.properties index 2e2dee983b..e808fdc288 100644 --- a/spring-jpa/src/main/resources/persistence-derby.properties +++ b/spring-jpa/src/main/resources/persistence-derby.properties @@ -7,4 +7,6 @@ jdbc.pass=tutorialpass # hibernate.X hibernate.dialect=org.hibernate.dialect.DerbyDialect hibernate.show_sql=false -hibernate.hbm2ddl.auto=create \ No newline at end of file +hibernate.hbm2ddl.auto=create +hibernate.cache.use_second_level_cache=false +hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/spring-jpa/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml b/spring-jpa/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml index 47082453b9..25d1d4d22f 100644 --- a/spring-jpa/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml +++ b/spring-jpa/src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml @@ -5,7 +5,7 @@ xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:security="http://www.springframework.org/schema/security" xmlns:tx="http://www.springframework.org/schema/tx" - xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd + xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd @@ -65,6 +65,8 @@ ${hibernate.hbm2ddl.auto} ${hibernate.dialect} + ${hibernate.cache.use_second_level_cache} + ${hibernate.cache.use_query_cache}