读书人

关于JOTM配置全局事务的有关问题实在

发布时间: 2012-11-01 11:11:33 作者: rapoo

关于JOTM配置全局事务的问题,实在是没办法了
xml配置如下

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:jee="http://www.springframework.org/schema/jee"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"><aop:config proxy-target-advice-ref="txAdvice" /></aop:config><tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes><tx:method name="save*"/><tx:method name="test*"/><tx:method name="*" read-only="true" /></tx:attributes></tx:advice><bean id="jotmJta" /><bean id="transactionManager" ref="jotmJta" /></bean><tx:annotation-driven transaction-manager="transactionManager"/> <bean id="ds1" destroy-method="close"><property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /><property name="url" value="jdbc:oracle:thin:@192.168.168.171:1521:cctveip" /><property name="username" value="a" /><property name="password" value="a" /></bean><bean id="sessionFactory1"/></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop></props></property><property name="mappingResources"><list><value>com/ctvit/test/domain/YbTest1.hbm.xml</value><value>com/ctvit/test/domain/YbTest2.hbm.xml</value></list></property></bean><bean id="testSerivce" ref="YbTest1DAO"></property><property name="tes2Dao" ref="YbTest2DAO"></property></bean><bean id="YbTest1DAO" /></property></bean><bean id="YbTest2DAO" /></property></bean></beans>


java 测试代码如下
import org.springframework.context.ApplicationContext;import org.springframework.test.AbstractDependencyInjectionSpringContextTests;import com.ctvit.test.struts.TestSerivce;public class TestXa extends AbstractDependencyInjectionSpringContextTests  {protected String[] getConfigLocations() {return new String[] { "classpath:applicationContext.xml" };}public void testJOTM()  {ApplicationContext ctx = this.getApplicationContext();TestSerivce testSerivce = (TestSerivce)ctx.getBean("testSerivce");try {testSerivce.saveTest();} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();} }}
1 楼 yangbo9229 2008-03-11 问题已经解决

读书人网 >软件架构设计

热点推荐