spring 中的声明式事务不回滚 请高手帮忙解决一下 谢谢!
来源:互联网 发布:nginx apache ssl 编辑:程序博客网 时间:2024/05/18 01:08
<?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: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/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">
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="do*" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- 那些类的哪些方法参与事务 -->
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.hibernate.bankImpl.*.*(..))"/>
<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
</aop:config>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver" />
<property name="url" value="jdbc:microsoft:sqlserver://localhost:1433" />
<property name="username" value="admin" />
<property name="password" value="adminsa" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>com/hibernate/BankTab.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/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">
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="do*" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- 那些类的哪些方法参与事务 -->
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.hibernate.bankImpl.*.*(..))"/>
<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
</aop:config>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver" />
<property name="url" value="jdbc:microsoft:sqlserver://localhost:1433" />
<property name="username" value="admin" />
<property name="password" value="adminsa" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>com/hibernate/BankTab.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
- spring 中的声明式事务不回滚 请高手帮忙解决一下 谢谢!
- 高手帮忙解决一下
- 帮忙解决一下,谢谢了
- C#程序集问题,请高手帮忙解决一下!!
- 如何在特定的区域提问?请哪位高手帮忙指点一下,谢谢!
- [VB.NET]急,高手帮忙解决,谢谢!
- 数据结构 栈问题(在TC能运行,但是是死循环,请高手帮忙调试一下,谢谢~)
- 蓝牙问题。请真正的c#高手帮忙?谢谢
- Hibernate查询错误!请高手帮忙解决!
- Hibernate查询错误!请高手帮忙解决!
- 帮忙看一下。谢谢!
- C 语言高手请帮忙讲解一下怎么调用函数
- 解决Spring的声明式事务中的自定义异常不回滚问题
- 请高手指教!谢谢!
- 请高手们帮忙!!!!
- 请高手帮忙!
- 请各位高手帮忙!
- 请高手帮忙!
- 3322 动态域名更新 IP 程序补丁
- 12月13日南京大屠杀,让我们为30万遇难者哀思!
- 社区信息管理系列软件开发完成
- 彻底明白操作系统环境变量
- 在AIX上用IBM的JVM,内存溢出时默认地会产生javacore文件(关于cpu的)和heapdump文件(关于内存的)。手动产生堆栈文件的方法是使用kill -3
- spring 中的声明式事务不回滚 请高手帮忙解决一下 谢谢!
- 转行
- 变态服务器安全设置
- 根据基本表结构及其数据生成 INSERT INTO ... 的 SQL
- 在Windows下使用Eclipse + CDT+MinGW开发C/C++程序
- Struts ,Hibernate ,Spring 常用整合配置方法.
- 红黑树: 理论与实现(理论篇)[修订版]
- 短信报警
- Lucene 课程设计 检索.doc,.pdf,.html,.execl,.txt格式文件