少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

          常用鏈接

          留言簿(22)

          我參與的團隊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          <?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/tx
              http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
              http://www.springframework.org/schema/aop
              http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

              <!--配置數(shù)據(jù)源 -->
              <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
                  destroy-method="close">
                  <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
                  <property name="url" value="jdbc:mysql://localhost:3306/abin"></property>
                  <property name="username" value="root"></property>
                  <property name="password" value="root"></property>
                  <property name="maxActive" value="100"></property>
                  <property name="maxIdle" value="30"></property>
                  <property name="maxWait" value="500"></property>
                  <property name="defaultAutoCommit" value="true"></property>
              </bean>

              <!-- session工廠 -->
              <bean id="sessionFactory"
                  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                  <property name="dataSource" ref="dataSource"></property>
                  <property name="hibernateProperties">
                      <props>
                          <prop key="hibernate.dialect">
                              org.hibernate.dialect.MySQLDialect    
                          </prop>
                          <prop key="hibernate.show_sql">true</prop>
                          <prop key="hibernate.format_sql">true</prop>
                          <prop key="hibernate.hbm2ddl.auto">update</prop>
                      </props>
                  </property>
                  <property name="mappingResources">
                      <list>
                          <value>com/abin/conference/hbm/ConferenceBean.hbm.xml</value>
                      </list>
                  </property>
              </bean>

              <!-- 事務管理器 -->
              <bean id="transactionManager"
                  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                  <property name="sessionFactory">
                      <ref local="sessionFactory" />
                  </property>
              </bean>

              <!-- 定義攔截器 -->
              <bean id="transactionInterceptor"
                  class="org.springframework.transaction.interceptor.TransactionInterceptor">
                  <property name="transactionManager">
                      <ref bean="transactionManager"></ref>
                  </property>
                  <property name="transactionAttributes">
                      <props>
                          <prop key="insert*">PROPAGATION_REQUIRED,ISOLATION_READ_COMMITTED,timeout_10,-EXCEPTION</prop>
                          <prop key="del*">PROPAGATION_REQUIRED</prop>
                          <prop key="update*">PROPAGATION_REQUIRED</prop>
                          <prop key="find">PROPAGATION_REQUIRED</prop>
                          <prop key="get">PROPAGATION_REQUIRED</prop>
                      </props>
                  </property>
              </bean>

              <!-- 定義業(yè)務對象的事務代理對象 -->
              <bean id="userService" class="org.springframework.aop.framework.ProxyFactoryBean">
                  <property name="target" ref="userServiceTarget"></property>
                  <property name="interceptorNames">
                      <value>transactionInterceptor</value>
                  </property>
              </bean>





              <!-- 配置事務特性,配置add,delete,update開始的方法,事務傳播特性為required -->
              <!--
              <tx:advice id="txAdvice" transaction-manager="transactionManager">
                  <tx:attributes>
                      <tx:method name="add*" propagation="REQUIRED" />
                      <tx:method name="delete*" propagation="REQUIRED" />
                      <tx:method name="update*" propagation="REQUIRED" />
                      <tx:method name="*" read-only="true" />
                  </tx:attributes>
              </tx:advice>
              -->
              <!--
              <aop:config>
                  <aop:pointcut id="allManagerMethod"
                      expression="execxution(*
                  com.abin.conference.service.*.*(..))"></aop:pointcut>
                  <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"></aop:advisor>
              </aop:config>
              -->
          </beans>
          posted on 2012-03-19 23:53 abin 閱讀(515) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 纳雍县| 且末县| 子长县| 张北县| 长顺县| 卢氏县| 平安县| 台东市| 延寿县| 屯昌县| 稻城县| 马公市| 河北省| 临颍县| 浮梁县| 怀集县| 康定县| 凤冈县| 安福县| 东山县| 石台县| 瑞昌市| 民丰县| 万山特区| 苏尼特右旗| 封开县| 淮北市| 凤阳县| 华阴市| 建湖县| 阿合奇县| 正宁县| 长岭县| 茶陵县| 军事| 会东县| 酒泉市| 木里| 土默特左旗| 平安县| 乌什县|