我的问题是这样的:我在两个service中分别调用两个代码几乎相同的dao中方法查询数据库,现在是一个dao正常,另一个在getCurSession(MYSQL).createQuery(sql)句抛出异常,异常:
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
我按照百度的方法,在配置文件中加了这两句话后,
报错改了:createsqlquery is not valid without active transaction
我的配置文件是:
dao:
service:
两个都没有用@trancational注解
忘各位帮忙看看,谢谢了