java-spring事务管理部分代码主要代码
来源:互联网 发布:淘宝一手货源一件代发 编辑:程序博客网 时间:2024/06/11 08:29
此处以一个applicationContext.xml文件头部配置文件为例
<beansxmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
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-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop <!---------要添加的------------->
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd<!---------要添加的------------->
http://www.springframework.org/schema/tx <!---------要添加的------------->
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"><!---------要添加的------------->
//该处是配置事务管理的代码
<!--配置hibernate的事务管理器 -->
<bean id="txManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<propertyname="sessionFactory"ref="sessionFactory"/>
</bean>
<tx:adviceid="txadvice"transaction-manager="txManager">
<tx:attributes>
<tx:methodname="save*"propagation="REQUIRED"isolation="DEFAULT"/>
<tx:methodname="delete*"propagation="REQUIRED"isolation="DEFAULT"/>
<tx:methodname="find*"read-only="false"/>
<tx:methodname="get*"read-only="false"/>
</tx:attributes>
</tx:advice>
<!--配置切面 -->
<aop:config>
<aop:pointcutid="commonPointcut"expression="execution(* *..service..*.*(..))"/>
<aop:advisoradvice-ref="txadvice"pointcut-ref="commonPointcut"/>
</aop:config>
<beanid="hibernateTemplate"class="org.springframework.orm.hibernate3.HibernateTemplate">
<propertyname="sessionFactory"ref="sessionFactory"/>
</bean>
<beanid="baseDao"class="com.util.dao.imp.BaseDao">
<propertyname="hibernateTemplate"><refbean="hibernateTemplate"/></property>
</bean>
<beanid="baseService"class="com.util.service.imp.BaseService"abstract="true"/>
</beans>
- java-spring事务管理部分代码主要代码
- Spring事务管理代码剖析
- java记事本主要代码
- spring AOP 部分代码
- Spring 声明式事务管理核心代码分析
- 主要数据库连接核心代码【Java】
- java记事本主要代码2
- java记事本主要代码3
- ATM部分java代码
- spring的事务管理,事务隔离级别(代码级别)
- spring声明式事务管理代码示例(五种写法)
- Axis2+hibernate 编写webservice(主要部分代码)
- JAVA MSN机器人主要代码开放
- java链接pos打印机 主要代码!
- java代码部分优化策略
- Quiz项目java代码部分
- Java Spring 事务管理
- 代码 部分
- uva - 10602 - Editor Nottoobad(贪心)
- 64位win7平台下,使用C语言通过odbc无法连接MySQL数据库的问题。
- LeetCode之Minimum Depth of Binary Tree
- cocos2d-x2.2 win7创建项目
- 黑马程序员--单例模式
- java-spring事务管理部分代码主要代码
- 前缀和--Openmp
- sci.misc.imread读取数据为空 或者 IOError: decoder zip not available decoder jpeg not available 解决办法
- Cstyle的札记,R&D必读手册,第4篇 Embedded Ethernet Controller
- WebKit专栏
- c# 互斥锁(Mutex)使用详解
- golang动态解析xml
- 数据结构-van emde boas 树
- 大电容并小电容