关于spring事务问题?
本人对hibernate只读查询需不需要事务的问题一直没有弄明白,有人说需要事务,有人说不需要事务,还请高人指点!谢谢
我经常看到别人写的代码中包含如下语句:@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true),
我的想法就是如果不需要事务,就没有必要加上这句话了,但是一旦将这句话去掉,则报如下异常:
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here