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>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…