• jboss数据源配置


    http://blog.csdn.net/clinique/article/details/7482670

    最近项目相关的JBOSS配置开始,留下点什么

    项目使用的是local-tx-datasource, 网上找了很多资料,都没有明确说明local-tx-datasource和xa-datasource的区别,而且中文的资料太少,去JBOSS Community 查看了一圈找到了有价值的信息。

    1. local-tx-datasouce 能不能参与JTA事务

    JBOSS Administration_Configuration_Guide上的解释

    <no-tx-datasource>

    Does not take part in JTA transactions. The Java.sql.Driveris used.

    <local-tx-datasource>

    Does not support two phase commit. The java.sql.Driveris used. Suitable for a single database or a non-XA-aware resource.

    <xa-datasource>

    Supports two phase commit. The javax.sql.XADataSourcedriver is used.

    说的比较清楚,local-tx-datasource是可以作为JTA事务参与者的, 只是不支持2PC协议(two-Phase-Commit Protocol)。

    1. 一个Application 能不能定义多个local-tx-datasource数据源,什么时候用xa-datasource

    在Forum上到的讨论结果,JBOSS的开发人员认证了一下说法

    You have to usexa-datasources in cases where onetransaction spans multiple datasources. Regardless of wheter Iuse a cluster or not.

    For example amethod consuming a JMS message and manipulating a JPA Entity.

    对这个说法的解释就是,一个Application可以定义并使用很多个local-tx-datasource数据源,但是一个事务(Transaction)只能操作一个数据源。当你的事务需要同时处理不同的数据源的时候,必须定义为xa-datasource,否则会出现org.jboss.util.NestedSQLException:Could not enlist in transaction on entering meta-aware object 的报错。

  • 相关阅读:
    三联生活周刊:女游戏设计师之死
    HTML
    营运社区所需要的基本心理学常识
    对C++下struct 和 类默认继承的认识
    什么是列表?
    什么是个人网站?
    DevExpress ASPxListBox can't get selected items after postback
    ListItemEventHandler does not fire on the prospective list
    SPF和SharePoint Server的区别
    什么是网站?
  • 原文地址:https://www.cnblogs.com/jiaozi-li/p/7308239.html
Copyright © 2020-2023  润新知