使用什么事务管理器?(JPA, 春天) [英] What transaction manager to use? (JPA, Spring)

查看:24
本文介绍了使用什么事务管理器?(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 来自 Spring 参考以更好地理解这个主题.

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

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

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