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

Spring 三以上废弃了Jotm

2013-12-28 
Spring 3以上废弃了Jotm? ? ?Spring 3以上版本,去掉了org.springframework.transaction.jta.JotmFactoryBe

Spring 3以上废弃了Jotm

? ? ?Spring 3以上版本,去掉了org.springframework.transaction.jta.JotmFactoryBean类,不能通过集成Jotm实现Jta功能。
? ? ? 看来只能利用容器实现Jta功能了。见如下Spring文档:

<beans>    <jee:jndi-lookup id="dataSource1" jndi-name="java:comp/env/jdbc/myds1"/>    <jee:jndi-lookup id="dataSource2" jndi-name="java:comp/env/jdbc/myds2"/>    <bean id="mySessionFactory1"            class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">        <property name="dataSource" ref="myDataSource1"/>        <property name="mappingResources">            <list>                <value>product.hbm.xml</value>            </list>        </property>        <property name="hibernateProperties">            <value>                hibernate.dialect=org.hibernate.dialect.MySQLDialect                hibernate.show_sql=true            </value>        </property>    </bean>    <bean id="mySessionFactory2"            class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">        <property name="dataSource" ref="myDataSource2"/>        <property name="mappingResources">            <list>                <value>inventory.hbm.xml</value>            </list>        </property>        <property name="hibernateProperties">            <value>                hibernate.dialect=org.hibernate.dialect.OracleDialect            </value>        </property>    </bean>    <bean id="myTxManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>    <bean id="myProductDao" class="product.ProductDaoImpl">        <property name="sessionFactory" ref="mySessionFactory1"/>    </bean>    <bean id="myInventoryDao" class="product.InventoryDaoImpl">        <property name="sessionFactory" ref="mySessionFactory2"/>    </bean>    <bean id="myProductService" class="product.ProductServiceImpl">        <property name="productDao" ref="myProductDao"/>        <property name="inventoryDao" ref="myInventoryDao"/>    </bean>    <aop:config>        <aop:pointcut id="productServiceMethods"                expression="execution(* product.ProductService." propagation="REQUIRED"/>            <tx:method name="someOtherBusinessMethod" propagation="REQUIRES_NEW"/>            <tx:method name="*" propagation="SUPPORTS" read-only="true"/>        </tx:attributes>    </tx:advice></beans>

热点排行