Spring 声明式事务处理....XML

本文涉及的产品
云数据库 RDS SQL Server,独享型 2核4GB
简介:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns=" http://www.springframework.org/schema/beans "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd ">

<bean id="datasource"
  class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName"
   value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
  </property>
  <property name="url"
   value="jdbc:sqlserver://localhost:1433;databaseName=hahademo">
  </property>
  <property name="username" value="sa"></property>
</bean>
<bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref bean="datasource"></ref>
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.SQLServerDialect
    </prop>
   </props>
  </property>
  <property name="mappingResources">
   <list>
    <value>po/Bank.hbm.xml</value>
   </list>
  </property>
</bean>
<bean name="/bank" class="action.BankAction">
  <property name="bankBiz">
   <ref bean="bankbiz" />
  </property>
</bean>
<bean id="bankbiz" class="biz.BankBizImpl">
  <property name="commonDao">
   <ref bean="commondao" />
  </property>
</bean>
<bean id="commondao" class="dao.CommonDaoImpl">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
</bean>
<bean id="transactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
</bean>
<bean id="transactionInterceptor"
  class="org.springframework.transaction.interceptor.TransactionInterceptor">
  <property name="transactionManager">
   <ref bean="transactionManager" />
  </property>
  <property name="transactionAttributes">
   <props>
    <prop key="a">PROPAGATION_REQUIRED</prop>
   </props>
  </property>
</bean>
<bean id="transactionInterceptor1"
  class="org.springframework.transaction.interceptor.TransactionInterceptor">
  <property name="transactionManager">
   <ref bean="transactionManager" />
  </property>
  <property name="transactionAttributes">
   <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
   </props>
  </property>
</bean>
<bean
  class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  <property name="beanNames">
   <list>
    <value>bankbiz</value>
   </list>
  </property>
  <property name="interceptorNames">
   <list>
    <value>transactionInterceptor</value>
    <value>transactionInterceptor1</value>
   </list>
  </property>
</bean>
<!--
  <bean id="biztransactionproxy" 
  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
  <property name="transactionManager">
  <ref bean="transactionManager" />
  </property>
  <property name="target">
  <ref bean="bankbiz" />
  </property>
  <property name="transactionAttributes">
  <props>
  <prop key="*">PROPAGATION_REQUIRED</prop>
  </props>
  </property>
  </bean>
-->

</beans>



本文转自左正博客园博客,原文链接:http://www.cnblogs.com/soundcode/archive/2010/12/20/1911890.html,如需转载请自行联系原作者

相关实践学习
使用SQL语句管理索引
本次实验主要介绍如何在RDS-SQLServer数据库中,使用SQL语句管理索引。
SQL Server on Linux入门教程
SQL Server数据库一直只提供Windows下的版本。2016年微软宣布推出可运行在Linux系统下的SQL Server数据库,该版本目前还是早期预览版本。本课程主要介绍SQLServer On Linux的基本知识。 相关的阿里云产品:云数据库RDS&nbsp;SQL Server版 RDS SQL Server不仅拥有高可用架构和任意时间点的数据恢复功能,强力支撑各种企业应用,同时也包含了微软的License费用,减少额外支出。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/sqlserver
目录
相关文章
|
2月前
Spring5源码(45)-@Transactional声明式事物(三)事物创建
Spring5源码(45)-@Transactional声明式事物(三)事物创建
39 0
|
2月前
|
Java Spring 容器
Spring5源码(42)-@Transactional注解的声明式事物事物标签提取
Spring5源码(42)-@Transactional注解的声明式事物事物标签提取
29 0
|
2月前
|
XML Java 数据格式
Spring IoC容器初始化过程(xml形式)
Spring IoC容器初始化过程(xml形式)
44 0
|
3月前
|
XML Java 数据库连接
JAVAEE框架整合技术之spring03-SpringJdbcTemplate模板技术和事务处理
JAVAEE框架整合技术之spring03-SpringJdbcTemplate模板技术和事务处理
67 0
|
2月前
|
Java Spring
Spring5源码(43)-@Transactional声明式事物(一)事物管理步骤简析
Spring5源码(43)-@Transactional声明式事物(一)事物管理步骤简析
33 0
|
2月前
|
XML 运维 Java
spring事务(3)基于XML的声明式事务
spring事务(3)基于XML的声明式事务
16 0
|
2月前
|
数据库
Spring5源码(49)-@Transactional声明式事物(七)嵌套事物回滚
Spring5源码(49)-@Transactional声明式事物(七)嵌套事物回滚
29 0
|
2月前
|
Java 数据库 Spring
Spring5源码(48)-@Transactional声明式事物(六)嵌套事物处理
Spring5源码(48)-@Transactional声明式事物(六)嵌套事物处理
39 0
|
2月前
|
Java Spring
Spring5源码(47)-@Transactional声明式事物(五)嵌套事物简介
Spring5源码(47)-@Transactional声明式事物(五)嵌套事物简介
27 0
|
2月前
|
Java 数据库连接
Spring5源码(46)-@Transactional声明式事物(四)回滚
Spring5源码(46)-@Transactional声明式事物(四)回滚
26 0