Hi! I'm developing a web application based on JPA + Hibernate, Spring and Wicket. I was wondering what's the best way of implementing transactions in my code? What transaction manager should I use? Should it be org.springframework.orm.jpa.JpaTransactionManager
, or org.springframework.jdbc.datasource.DataSourceTransactionManager
or something else? I'd like to use Spring for managing my transactions.
views:
69answers:
2
+2
A:
org.springframework.orm.jpa.JpaTransactionManager
My preference is to use this with annotation:
<tx:annotation-driven transaction-manager="myTxManager" />
nanda
2010-10-07 10:05:20
+2
A:
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.
seanizer
2010-10-07 10:30:38
ok, thanks a lot guys!
John Manak
2010-10-07 10:45:47
+1 for your for completeness and +1 for nanda too to be fair :)
Pascal Thivent
2010-10-07 11:12:03