首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

事务处理配备

2012-08-10 
事务处理配置spring和hibernate整合是事物处理配置?xml version1.0 encodingUTF-8?beansxmlnsh

事务处理配置

spring和hibernate整合是事物处理配置
<?xml version="1.0" encoding="UTF-8"?><beansxmlns="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"><!-- sessionFactory --><bean id="hello" value="hr"></property><property name="password" value="hr"></property></bean><bean id="sessionfactory"/></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop></props></property><property name="mappingResources"><list><value>com/yidu/dao/Customer.hbm.xml</value><value>com/yidu/dao/Ord.hbm.xml</value></list></property></bean><bean id="CustomerDAO" /></property></bean><bean id="OrdDAO" /></property></bean><!-- VO对象 --><bean id="cus" value="4"></property><property name="name" value="xiaoqi"></property></bean><!-- 业务逻辑 --><bean id="CustomerBiz" ref="CustomerDAO"></property><property name="customer" ref="cus"></property></bean><!-- 事物处理 --><!-- 定义事物管理器通知 --><bean id="transManager" ref="sessionfactory"></property></bean><!-- 定义一个切入点 --><bean id="cutPointTran" ref="transManager"></property><property name="transactionAttributes"><props><prop key="*">PROPAGATION_REQUIRED</prop></props></property></bean></beans>
spring和ibatis整合事务处理的配置
<?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"value="hr"></property><property name="password" value="hr"></property></bean><!-- sqlMapClient --><bean id="sqlMapClient"ref="dataSource"></property><property name="configLocation" value="file:src/Ibatis.xml"></property></bean><!--SqlMapClientTemplate --><bean id="SqlMapClientTemplate"ref="sqlMapClient"></property><!-- VO对象 --></bean><bean id="customer" value="21"></property><property name="name" value="马子"></property></bean><!-- Dao层代码 --><!-- 继承了SqlMapClientTemplate模板对象的 --><bean id="cusSupport" ref="customer"></property><property name="sqlMapClient" ref="sqlMapClient"></property></bean><!-- 没继承的,需要注入 --><bean id="cusTimp" ref="customer"></property><property name="sct" ref="SqlMapClientTemplate"></property></bean><!-- 注入cusSupp DAO --><bean id="cusBiz" ref="cusSupport"></property></bean><!-- 注入templateDao --><bean id="templatebiz" ref="cusTimp"></property></bean><!-- 定义事物管理器(专门由于处理事物的通知) --><bean id="tranct"ref="dataSource" /></bean><!-- 定义事务拦截器(事物切入点) --><bean id="trInterceptor"ref="tranct"></property><property name="transactionAttributes"><props><prop key="*">PROPAGATION_REQUIRED</prop></props></property></bean><!-- 自动代理 --><bean id="autoProxy"name="code">ibatis的配置
?
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE sqlMapConfig          PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"          "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"><sqlMapConfig>    <transactionManager type="JDBC"><dataSource type="SIMPLE"><property name="JDBC.Driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/><!-- 只能用该驱动程序 --><property name="JDBC.ConnectionURL" value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=javaEE;SelectMethod=Cursor"/><property name="JDBC.Username" value="sa"/><property name="JDBC.Password" value="123"/></dataSource></transactionManager><sqlMap resource="com/yidu/bean/Classes.xml" /><sqlMap resource="com/yidu/bean/Student.xml"/></sqlMapConfig>
?

热点排行