解决hibernate session满问题

解决hibernate session满问题
第一种方法:放开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 >

你可能感兴趣的:(解决hibernate session满问题)