最近总是遇到
HibernateException: Could not obtain transaction-synchronized Session for current thread错误
业务场景:在job中执行Service中的方法(事务是在xml中配置,针对所有service的方法的)
我的springContext.xml配置如下:
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" propagation="NOT_SUPPORTED" read-only="true" />
<tx:method name="select*" propagation="NOT_SUPPORTED" read-only="true" />
<tx:method name="query*" propagation="NOT_SUPPORTED" read-only="true" />
<tx:method name&#