yj10864

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            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 閱讀(211) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 玉门市| 扶沟县| 石柱| 句容市| 连山| 安庆市| 三门峡市| 紫云| 新沂市| 邵武市| 郎溪县| 永顺县| 安岳县| 荣昌县| 福建省| 吴桥县| 阳原县| 宁阳县| 宁津县| 吕梁市| 博湖县| 双流县| 锦州市| 彰化市| 射洪县| 通州市| 汉阴县| 南汇区| 和田县| 萍乡市| 郁南县| 通道| 扬州市| 鹿邑县| 美姑县| 襄汾县| 苏尼特右旗| 蛟河市| 额尔古纳市| 南靖县| 鞍山市|