首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

用Spring集成的JOTM配备分布式事务,结合hibernate jpa

2012-09-04 
用Spring集成的JOTM配置分布式事务,结合hibernate jpa最近项目中涉及到了两个Oracle数据库的操作。需要用到

用Spring集成的JOTM配置分布式事务,结合hibernate jpa
最近项目中涉及到了两个Oracle数据库的操作。需要用到分布式事务,研究之后贴出代码供大家参考。

1.dao-core.xml(核心事务配置XML)



2.persistence.xml



3.persistenceWoniu.xml



4.MyTest-context.xml



5.IJTATestService.java接口

EntityManager entityManager=this.getCmsEntityManagerFactory().createEntityManager();Session session=(Session)entityManager.getDelegate();SessionFactory sessionFactory=session.getSessionFactory();


9.特别说明

在项目测试的过程中,有一个错误困扰了我很久,总会报这样的错误

Hibernate: select SN_WONIU.SYS_COMPANY_SQ.nextval from dual
java.sql.SQLException: Cannot get connection for URL jdbc:oracle:thin:@192.168.6.80:1521:C2SServer : 调用中无效的参数

Google了一大圈有不少人碰到这个问题,后来偶是在http://forum.springsource.org/archive/index.php/t-28145.html找到了答案,就是在配置数据源的时候,StandardXAPoolDataSource中要配置user和password,StandardXADataSource中也要配置user和password。 不明白为啥,希望高人不吝赐教。

热点排行