08-02-2023, 03:43 PM
Is it possible to have *Spring* inject the JPA `entityManager` object into my DAO class without extending `JpaDaoSupport`? If yes, does Spring manage the transaction in this case?
I'm trying to keep my Spring configuration as simple as possible:
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="em"/>
</bean>
<bean id="em" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="myPU"/>
</bean>
I'm trying to keep my Spring configuration as simple as possible:
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="em"/>
</bean>
<bean id="em" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="myPU"/>
</bean>