spring 是否能进行分布式事务管理? 请问,spring 是否能进行分布式事务管理?如果能的话能否举一个例子。还有,除了EJB外,进行分布式事务管理还有什么好的方式没有,小弟不是很了解EJB。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我觉得可以吧,你说的分布式事务是指跨越多个数据源的事务吧。在Spring里提供了声明式事务,所以可以通过JTA实现分布式事务。 <?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:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <bean id="hibTxManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 事物传播特性--> <tx:advice id="txAdvice" transaction-manager="hibTxManager"> <tx:attributes> <tx:method name="save*" read-only="true" /> <tx:method name="del*" read-only="true" /> <tx:method name="search" read-only="true" /> <tx:method name="*" propagation="REQUIRED"/> </tx:attributes> </tx:advice> <!-- 事物传播到方法--> <aop:config> <aop:pointcut id="bizMethods" expression="execution(* cn.com.yyaccp.service.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods" /> </aop:config></beans> 求将mysql数据导出成excel文件的方法 MyEclipse配置Tomcat webservice报错 hibernate问题2 上海创业 用IntelliJIDEA和Tomcat5.0编的程序出现以下错误,什么原因? 请问一个简单的问题,shhgs 的中文姓名?? 菜鸟问题:JSP中的端口问题? 在用J2EE做网上书店,点击“正式购买”后好让电脑自动向用户发出一封确认邮件,代码是怎么写的阿!!!!!!! javamail中如何设置邮件回复的地址??? 惊奇发现:Hibernate官网是不是被黑了 struts2标签的使用,高手新手都进
在Spring里提供了声明式事务,所以可以通过JTA实现分布式事务。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <bean id="hibTxManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <!-- 事物传播特性-->
<tx:advice id="txAdvice" transaction-manager="hibTxManager">
<tx:attributes>
<tx:method name="save*" read-only="true" />
<tx:method name="del*" read-only="true" />
<tx:method name="search" read-only="true" />
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice> <!-- 事物传播到方法-->
<aop:config>
<aop:pointcut id="bizMethods"
expression="execution(* cn.com.yyaccp.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods" />
</aop:config></beans>