What transaction manager to use? (JPA, Spring)
org.springframework.orm.jpa.JpaTransactionManager
My preference is to use this with annotation:
<tx:annotation-driven transaction-manager="myTxManager" />
nanda is right, you can only use JpaTransactionManager. The Transaction Manager abstraction we are talking about here is Spring's PlatformTransactionManager interface, and JPATransactionManager is the only implementation of that interface that understands JPA.
You should read the chapter Transaction Management from the Spring reference to better understand this topic.
The org.springframework.transaction.PlatformTransactionManager interface is the key abstraction in the Spring API providing essential methods for controlling transaction operations at run-time: begin, commit and rollback.
PlatformTransactionManager interface, its implementations
- JtaTransactionManager -----> JTA
- DataSourceTransactionManager -----> JDBC
- JpaTransactionManager ------> JPA
- HibernateTransactionManager ------> Hibernate
it depand on your requirment which moudle of spring your are using