CreateQuery is not valid without active transaction

我是研究僧i 提交于 2019-12-01 05:27:07

You have to explicitly declare support for transaction manager annotation

Add to your config:

<tx:annotation-driven transaction-manager="transactionManager"/>

tx is xmlns:tx="http://www.springframework.org/schema/tx" namespace.

and delete this line:

<beans:prop key="hibernate.current_session_context_class">${hibernate.current_session}</beans:prop>
Ratan Kumawat

remove this code

<beans:prop key="hibernate.current_session_context_class">org.hibernate.context.internal.ThreadLocalSessionContext </beans:prop>

and add this line

<tx:annotation-driven transaction-manager="transactionManager"
  mode="proxy" proxy-target-class="true" />

in your xml file where you set your hibernate transaction property.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!