2018-07-23

Spring Data JPA Junit test


Source URL: https://www.luckyryan.com/2013/06/25/integration-testing-spring-data-jpa/#comment-11973


All below need to be in place

xmlns:jpa="http://www.springframework.org/schema/data/jpa"

http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd

<jpa:repositories base-package="com.techstudio.staypleased.db" />

<!-- id cannot use other value -->
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

<property name="entityManagerFactory" ref="entityManagerFactory" />






something is not correct in the post:
https://stackoverflow.com/questions/23435937/how-to-test-spring-data-repositories

To make it short - there's no way to unit test Spring Data JPA repositories reasonably for a simple reason...