- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
他们建议在 Java EE 环境中使用 JTA 事务支持。
但是如何在Tomcat6中配置JTA让Hibernate Session可以使用呢?
Starting with version 3.0.1, Hibernate added the
SessionFactory.getCurrentSession()
method. Initially, this assumed usage of JTA transactions, where the JTA transaction defined both the scope and context of a current session. Given the maturity of the numerous stand-alone JTA TransactionManager implementations, most, if not all, applications should be using JTA transaction management, whether or not they are deployed into a J2EE container. Based on that, the JTA-based contextual sessions are all you need to use.
(Hibernate Reference Documentation | Architecture. Contextual Sessions)
最佳答案
如果您希望在 Tomcat 中支持 JTA,您需要使用独立的事务管理器,例如 Atomikos , JOTM , Bitronix , SimpleJTA , JBossTS或 GeronimoTM/Jencks .但老实说,如果您不打算处理跨多个资源的事务,那么您可以不使用 JTA(如果您真的需要 JTA,请使用完整的应用程序服务器)。
关于java - 如何在 Tomcat 6 中为 Hibernate 使用 JTA 支持?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2552612/
JTA 和本地事务有什么区别? 如果有一个示例可以展示何时使用 JTA 以及何时使用本地事务,那就太好了。 最佳答案 JTA 是用于管理 Java 事务的通用 API。它允许您以资源中立的方式启动、提
我正在使用 Atomikos 进行 JTA 事务。 我对 JTA 有以下设置: UserTransactionImp userTransactionImp = new UserTransactionI
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等方面的建议的问题。您可以编辑问题,以便用事实和引用来回答它。 关闭
我想找到一种方法来应用带有 JTA @Transactional 注释的自定义拦截器。 我有一个带有 @Transactional 的方法,它是业务事务之一。在该方法中我想: 进行一些数据库操作 使用
我正在更新旧的应用程序,并尽可能少地重新编程。我创建了一个与旧页面类似的页面,其中仅包含一些测试数据,以确保我可以创建与 ejb/jpa 的链接,但我遇到了问题。我将发布 jsp、persistenc
本文整理了Java中com.arjuna.ats.internal.jta.tools.osb.mbean.jta.XAResourceRecordBean类的一些代码示例,展示了XAResource
我们将 JPA 1.0 用于基于 ORM 的操作,并且我们希望我们的应用程序拥有 JTA 数据源。我们只有 1 个数据库,我们的应用程序将连接到该数据库。 我们在 Controller 类中开始我们的
本文整理了Java中com.arjuna.ats.internal.jta.tools.osb.mbean.jta.XAResourceRecordBean.()方法的一些代码示例,展示了XAReso
本文整理了Java中com.arjuna.ats.internal.jta.tools.osb.mbean.jta.XAResourceRecordBean.getUid()方法的一些代码示例,展示了
我如何定义 在 persistence.xml 中? 我的项目在 Tomcat 6 和 Tomcat 7 中运行良好。 现在我正在使用 Struts 2 Spring 3.0.5 JPA 2 Jbos
我想为我正在处理的应用程序编写集成测试。它使用 JTA(多资源)并在应用程序服务器内运行。为这种情况编写自动化测试的最佳方法是什么?使用像 atomikos 这样的独立事务管理器,或者以某种方式利用应
我们正在使用 jboss 管理的 EntityMangerFactory 使用以下 spring bean 现在在我们的 spring bean 中,我们使用 @PersistenceContext
从 JTA 规范中,我了解到它仅用于调用线程的分布式事务(或支持)。这是否意味着事务不能跨越多个线程?还是取决于实现? 是否有任何 JTA 实现支持跨线程 XA? 谢谢! 最佳答案 您可以使用 Tra
本地交易和BMT相同吗? 我们需要 transactionManager 来进行本地事务吗? 我读到 transactionManager 对于本地事务将无效。这是正确的吗? JTA 是否为 CMT
我是 Spring 和 hibernate 新手,请帮忙, 我正在使用(Jboss 6.0 Final 作为服务器) org.springframework.transaction.jta.JtaTr
假设我有一个托管 bean 并且定义了一个 EntityManager。我想知道交易是如何运作的以及它们在各种不同情况下的表现如何。从文档中我了解到,flush()实际上用于覆盖提交上的延迟并立即执行
试图将我的头脑围绕在 JTA 上并任意选择 Bitronix 作为 impl,因为文档更容易获得(与 Atmikos 相反,Atmikos 让你注册并注册以获得 src/docs/jars/等等)。
我使用以下我在网上找到的代码 ( Here ) 作为 JTA 事务处理的示例: // Get a UserTransaction UserTransaction txn = new I
我有 2 个 MySQL 架构和各自的 MysqlXADataSource 配置如下 - @Bean(name = "sourceDataSource") @Primary public DataSo
我正在开发一个Web应用程序,我必须使用我从未使用过的JTA。我开始使用 EntityManager 但它似乎在这里不起作用。当我使用 EntityManager 时,我收到此消息: Only per
我是一名优秀的程序员,十分优秀!