TransactionManager或JTATransactio

TransactionManager或JTATransactio

本文介绍了Spring + Hibernate + JTA - HibernateTransactionManager或JTATransactionManager的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想集成 Spring Hibernate ,并使用 JTA 管理事务。我也想把事务处理委托给App服务器,在我的例子中是JBoss。我有一个关于Spring中 transactionManager bean配置的查询:


$ b 我们可以使用 HibernateTransactionManager 并在hibernate.properties文件中设置属性 hibernate.transaction.factory_class hibernate.transaction.manager_lookup_class
如果没有,为什么?

或者,我们是否应该使用 JTATransactionManager



在选项(2)中,是否还需要在中设置属性(hibernate.transaction.factory_class,hibernate.transaction.manager_lookup_class) hibernate.properties



谢谢。

解决方案

如果你想委托给应用服务器,你必须使用JTATransactionManager,据我所知,HibernateTransactionManager不是JTA事务管理器。


I want to Integrate Spring and Hibernate and use JTA for managing the transactions. I would also like to delegate transaction handling to the App server, which in my case is JBoss. I have a query regarding the configuration of the "transactionManager" bean in Spring:

1) Can we use HibernateTransactionManager and set the the properties hibernate.transaction.factory_class and hibernate.transaction.manager_lookup_class in hibernate.properties file?If not, why?

2) Or, should we use JTATransactionManager?

In option (2), do we still need to set the properties("hibernate.transaction.factory_class", "hibernate.transaction.manager_lookup_class") in hibernate.properties?

Thanks.

解决方案

If you want to delegate to the appserver, you have to use JTATransactionManager to my knowledge, HibernateTransactionManager is not a JTA transaction manager.

这篇关于Spring + Hibernate + JTA - HibernateTransactionManager或JTATransactionManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 07:09
查看更多