non-transactional

this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery(queryString)报错No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here,因为没有配置事务

 

        <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">  
            <property name="sessionFactory" ref="sessionFactory" />  
            <property name="dataSource" ref="dataSource"/>  
        </bean>  
        <tx:advice id="txAdvice" transaction-manager="txManager">  
          <tx:attributes>  
              <tx:method name="*" propagation="REQUIRED" />  
           </tx:attributes>  
        </tx:advice>  

 

posted @ 2018-04-14 09:35  未来的羁绊  阅读(435)  评论(0编辑  收藏  举报