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>  

 

相关文章:

  • 2022-01-01
  • 2021-11-13
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
相关资源
相似解决方案