non-transactional
Posted 未来的羁绊
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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>
以上是关于non-transactional的主要内容,如果未能解决你的问题,请参考以下文章
报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transact