yj10864

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            8 Posts :: 1 Stories :: 9 Comments :: 0 Trackbacks
          第一種方法:放開session
          Session session=this.getSession();
          this.releaseSession(session)
          第二種方法配置事物:在applicationContext.xml中加入
          <!-- 事務 -->
              
          <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 閱讀(207) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 山丹县| 无为县| 忻城县| 临沧市| 岳池县| 栖霞市| 日照市| 云南省| 元谋县| 深水埗区| 颍上县| 龙泉市| 石柱| 原阳县| 古田县| 达拉特旗| 班戈县| 富蕴县| 济南市| 靖宇县| 陇西县| 乐平市| 夏河县| 瑞安市| 连城县| 陆良县| 栾城县| 黎川县| 英吉沙县| 瑞昌市| 蒙城县| 监利县| 会东县| 阿图什市| 岐山县| 拉萨市| 长垣县| 吴桥县| 青海省| 远安县| 朝阳市|