How to find compatible version pair of Hibernate + Spring-JPA? (Could not open JPA EntityManager for transaction)
Spring Data JPA v1.10.6 depends on Spring v4.2 (v4.2.9 to be precise) and Spring v4.2 does not support Hibernate v5.2. Support for Hibernate v5.2 was added only in Spring v4.3. Therefore, you must upgrade the Spring dependencies to v4.3.
Adding the following dependencies to the Gradle build file should work:
compile 'org.springframework:spring-beans:4.3.4.RELEASE'
compile 'org.springframework:spring-context:4.3.4.RELEASE'
compile 'org.springframework:spring-context-support:4.3.4.RELEASE'
compile 'org.springframework:spring-core:4.3.4.RELEASE'
compile 'org.springframework:spring-jdbc:4.3.4.RELEASE'
compile 'org.springframework:spring-orm:4.3.4.RELEASE'
compile 'org.springframework:spring-tx:4.3.4.RELEASE'
Your modified code available on Github. Run Gradle tests as gradle test
to verify that everything works fine.