什么交易经理使用? (JPA,春天) [英] What transaction manager to use? (JPA, Spring)

查看:176
本文介绍了什么交易经理使用? (JPA,春天)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于JPA + Hibernate,Spring和Wicket的Web应用程序。我想知道在我的代码中实现事务的最佳方法是什么?我应该使用什么交易经理?应该是 org.springframework.orm.jpa.JpaTransactionManager ,还是 org.springframework.jdbc.datasource.DataSourceTransactionManager 或别的什么?我想使用Spring来管理我的交易。

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.

推荐答案

nanda是对的,你可以只使用JpaTransactionManager。我们在这里讨论的事务管理器抽象是Spring的 PlatformTransactionManager 界面,以及 JPATransactionManager 是理解JPA的接口的唯一实现。

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.

您应该阅读 Transaction Management o更好地理解这个主题。

You should read the chapter Transaction Management from the Spring reference to better understand this topic.

这篇关于什么交易经理使用? (JPA,春天)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆