non-transactional

来源:互联网 发布:虚空假面 jb脸 知乎 编辑:程序博客网 时间:2024/06/09 16:45

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>


0 0
原创粉丝点击