<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:microsoft:sqlserver://192.168.14.231;DatabaseName=ocmsnc</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>sa</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- <prop key="hbm2ddl.auto">create</prop>-->
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
<prop key="hibernate.connection.pool.size">2</prop>
<prop key="jdbc.fetch_size">50</prop>
<prop key="jdbc.batch_size">25</prop>
<prop key="jdbc.use_scrollable_resultset">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<!-- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>-->
</props>
</property>
<property name="mappingResources">
<list>
<value>com/oaking/model/SmUser.hbm.xml</value>
</list>
</property>
<!--<property name="configLocation">-->
<!--<value>classpath:/hibernate.cfg.xml</value>-->
<!--</property>-->
</bean>
<bean id="myTransactionManager"
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="myTransactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="*">PROPAGATION_REQUIRED,-BaseException</prop>
</props>
</property>
</bean>
<bean id="baseService" abstract="true"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
<!-- ///////////////////////////////////////////////////-->
<!--第二种-->
<bean id="MyuserManager" parent="BaseTransactionProxy">
<property name="target">
<ref local="userManager"/>
</property>
</bean>
<bean id="BaseTransactionProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="myTransactionManager" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 第一种-->
<!-- <bean id="userManager" -->
<!-- class="com.yalta.customer.business.customer.spring.CustomerImp">
就是我们的实现业务逻辑的JavaBean的集合-->
<!-- <property name="userDao"> -->
<!-- <ref local="userdao"/> -->
<!-- </property> -->
<!-- <property name="deptDao"> -->
<!-- <ref local="deptdao"/> -->
<!-- </property> -->
<!-- </bean> -->
<!-- -->
<bean id="myBaseTransactionProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="myTransactionManager" />
<property name="target">
<ref local="userManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
<!-- <prop key="insert*">PROPAGATION_REQUIRED</prop> -->
<!-- <prop key="save">PROPAGATION_REQUIRED</prop> -->
<!-- <prop key="update*">PROPAGATION_REQUIRED</prop> -->
<!-- <prop key="edit*">PROPAGATION_REQUIRED</prop> -->
<!-- <prop key="del*">PROPAGATION_REQUIRED</prop> -->
<!-- <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> -->
<!-- <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop> -->
<!-- <prop key="disPlay*">PROPAGATION_REQUIRES_NEW</prop> -->
<!-- <prop key="log">PROPAGATION_REQUIRES_NEW</prop>-->
</props>
</property>
</bean>
<bean id="userdao" class="com.oaking.dao.UserDao">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!-- <bean id="UserService" parent="myBaseTransactionProxy"> -->
<!-- <property name="proxyTargetClass"> -->
<!-- <value>true</value> -->
<!-- </property> -->
<!-- <property name="target"> -->
<!-- <ref local="userdao" /> -->
<!-- </property> -->
<!-- </bean> -->
<!-- <bean id="UsersDAO" class="com.notepad.dao.UsersDAO"> -->
<!-- <property name="sessionFactory"> -->
<!-- <ref bean="mySessionFactory" /> -->
<!-- </property> -->
<!-- </bean> -->
<!-- -->
<!-- <bean id="userTarget" class="com.notepad.bussies.UserService"> -->
<!-- <property name="usersDao"> -->
<!-- <ref local="UsersDAO" /> -->
<!-- </property> -->
<!-- </bean> -->
<!-- <bean id="UserService" parent="myBaseTransactionProxy"> -->
<!-- <property name="proxyTargetClass"> -->
<!-- <value>true</value> -->
<!-- </property> -->
<!-- <property name="target"> -->
<!-- <ref local="userTarget" /> -->
<!-- </property> -->
<!-- </bean> -->
<!-- -->
<!-- <bean id="bean" class="org.springframework.aop.framework.ProxyFactoryBean">-->
<!-- <property name="proxyInterfaces">-->
<!-- <value>com.oaking.aop.Fool</value>-->
<!-- </property>-->
<!-- <property name="target">-->
<!-- <ref local="beanTarget"></ref>-->
<!-- </property>-->
<!-- <property name="interceptorNames">-->
<!-- <list>-->
<!-- <value>theAdvisor</value>-->
<!-- </list>-->
<!-- </property>-->
<!-- </bean>-->
<!-- <bean id="theAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">-->
<!-- <property name="advice">-->
<!-- <ref local="theBeforeAdvice"></ref>-->
<!-- </property>-->
<!-- <property name="pattern">-->
<!-- <value>com\.oaking\.aop\.Fool\.add</value>-->
<!-- <value>.*</value>-->
<!-- </property>-->
<!-- </bean>-->
<!-- <bean id="beanTarget" class="com.oaking.aop.ImpFool"></bean>-->
<!-- <bean id="theBeforeAdvice" class="com.oaking.aop.TestBeforeAdvice"></bean>-->
<!-- <bean id="myAfterAdvice" class="com.oaking.aop.MyAfterAdvice"></bean>-->
<!-- <bean id="myAroundAdvice" class="com.oaking.aop.MyAroundAdvice"></bean>-->
<!-- <bean id="myThrowsAdvice" class="com.oaking.aop.MyThrowsAdvice"></bean>-->
<!-- -->
<!-- -->
</beans>