yj10864

            BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
            8 Posts :: 1 Stories :: 9 Comments :: 0 Trackbacks
          第一種方法:放開session
          Session session=this.getSession();
          this.releaseSession(session)
          第二種方法配置事物:在applicationContext.xml中加入
          <!-- 事務(wù) -->
              
          <bean  id="tm"  class="org.springframework.orm.hibernate3.HibernateTransactionManager"  >
                  
          <property name="sessionFactory"  ref="sessionFactory"></property>
              
          </bean>
               
              
          <tx:advice  id="txAdvisor"   transaction-manager="tm">
                     
          <tx:attributes>
                        
          <tx:method  name="save*" propagation="REQUIRED"/>
                        
          <tx:method  name="add*" propagation="REQUIRED"/>
                        
          <tx:method  name="update*" propagation="REQUIRED"/>
                        
          <tx:method  name="del*"  propagation="REQUIRED"/>
                        
          <tx:method  name="*"   read-only="true"/>              
                     
          </tx:attributes>
              
          </tx:advice>
               
               
          <aop:config>
                  
          <aop:advisor  pointcut="execution(public  *  com.syy.cms.service.*.*(..))"   advice-ref="txAdvisor"/>
               
          </aop:config>
          posted on 2009-10-30 17:37 jerry yang 閱讀(210) 評(píng)論(0)  編輯  收藏

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 师宗县| 吉安市| 化州市| 怀集县| 进贤县| 辽宁省| 泰宁县| 天水市| 合江县| 霍城县| 济阳县| 阳山县| 永宁县| 双辽市| 遂昌县| 安顺市| 吉木乃县| 望江县| 冷水江市| 容城县| 白沙| 英超| 碌曲县| 冕宁县| 兴宁市| 监利县| 宁化县| 丰原市| 米易县| 神池县| 榕江县| 奉化市| 隆德县| 修武县| 海门市| 拉萨市| 开原市| 临邑县| 陆河县| 望谟县| 阜平县|