用Spring集成的JOTM配备分布式事务
用Spring集成的JOTM配置分布式事务?2.persistence.xml?? ?3.persistenceWoniu.xml?? ?4.MyTest-context.xm
用Spring集成的JOTM配置分布式事务
?
2.persistence.xml
?
?
?3.persistenceWoniu.xml
?
?
?4.MyTest-context.xml
?
?
?
?
5.IJTATestService.java接口
?
@ContextConfiguration@RunWith(SpringJUnit4ClassRunner.class)public class MyTest { @Autowiredprivate IJTATestService service; @org.junit.Test public void test() { SysCompany sysCompany = new SysCompany(); sysCompany.setSName("sss"); sysCompany.setSState("0"); SysUserRole role = new SysUserRole(); SysUserRoleId id = new SysUserRoleId(); id.setNRoleId(2L); id.setNUserId(1L); role.setId(id); GameGoodsType type = new GameGoodsType(); type.setSNo("aaa"); type.setSName("222"); type.setSState("1"); service.saveEntity(sysCompany, type); }}?
8.特别说明
在项目测试的过程中,有一个错误困扰了我很久,总会报这样的错误
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。 不明白为啥,希望高人不吝赐教。
?