We currently have Spring 3.2.9.RELEASE configured and running (for a couples of years) and need to migrate to 4.1.4.RELEASE. We have an abstract DAO class that extends org.springframework.orm.jpa.support.JpaDaoSupport
as well as other references to:
org.springframework.orm.jpa.JpaCallback
org.springframework.orm.jpa.JpaTemplate
I've seen that JpaDaoSupport
has been removed in Spring 4. I've removed references to the Jpa* classes and replaced with
@PersistenceContext
protected EntityManager theEntityManager;
and for method references in our DAO (like findByNamedParams()
) found in JpaDaoSupport
, and copied into our DAO.
After the above changes, we are able to compile our code but when it comes to running our JUnit tests, there is a reference in our applicationContext-test.xml
of
<bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="abstractDAO" abstract="true" class="my.company.package.AbstractDAO">
<property name="jpaTemplate" ref="jpaTemplate" />
</bean>
<bean id="genericDAO" parent="abstractDAO" class="my.company.package.GenericDAO" />
<bean id="securityDAO" parent="abstractDAO" class="my.company.package.SecurityDAOImpl" />
Basically the error is there is no class reference of org.springframework.orm.jpa.JpaTemplate
. How do we replace this JpaTemplate
configuration for Spring 4.1.4?
Note that I'm picking this code up and wasn't the one who initially configured the system. Also I'm pretty new to Spring and its configuration setup.