EJB 配置多个数据源
2014-02-11 09:58
302 查看
1.修改jboss-6.simple\server\default\deploy\transaction-jboss-beans.xml
配置文件
<bean name="CoreEnvironmentBean" class="com.arjuna.ats.arjuna.common.CoreEnvironmentBean">
中增加
<property name="allowMultipleLastResources">true</property>
2.添加xx_ds.xml配置文件
比如有两个数据库sqlserver和oracle
添加mssql-ds.xml
添加oracle-ds.xml
如果有两个sqlserver或者oracle,在一个配置文件中添加两个
<local-tx-datasource>
</local-tx-datasource>
3.配置persistence.xml
其中
<exclude-unlisted-classes>true</exclude-unlisted-classes>不能少,<class>com.railway.entity.AssetsEntity</class>
<class>com.railway.entity.FaultEntity</class>为你对应数据库的实体类。
4.调用Datasource
@PersistenceContext(unitName="jifangjiankong") EntityManager em;
配置文件
<bean name="CoreEnvironmentBean" class="com.arjuna.ats.arjuna.common.CoreEnvironmentBean">
中增加
<property name="allowMultipleLastResources">true</property>
2.添加xx_ds.xml配置文件
比如有两个数据库sqlserver和oracle
添加mssql-ds.xml
添加oracle-ds.xml
如果有两个sqlserver或者oracle,在一个配置文件中添加两个
<local-tx-datasource>
</local-tx-datasource>
3.配置persistence.xml
其中
<exclude-unlisted-classes>true</exclude-unlisted-classes>不能少,<class>com.railway.entity.AssetsEntity</class>
<class>com.railway.entity.FaultEntity</class>为你对应数据库的实体类。
4.调用Datasource
@PersistenceContext(unitName="jifangjiankong") EntityManager em;
相关文章推荐
- Generate source code from wsdl
- 如何选择开源许可证?
- spring jar包
- NYOJ 817 英文藏头诗
- Android杂谈--打开文件的Intent及使用
- 如何选择开源许可证?
- mysql 错误处理
- C#值类型赋值和引用类型赋值
- 汉字转拼音 - 输入汉字获取其拼音
- 排列组合
- ruby判断数字类型函数
- 禁止AutoCAD联网
- 解决svn log显示no author,no date的方法之一。
- SAS 9.3 x64 导入导出Excel出现问题解决方法
- 设计模式-适配器模式
- 做注册的验证,在服务器端处理,客服端ajax异步提交数据
- 马年工作 First Day
- Android Says Bonjour
- [转载]bigtable 中文版
- 小强的HTML5移动开发之路(40)——jqMobi中实践header定义的几种方式