转自:http://shuaigg-babysky.iteye.com/blog/563423 此设置的作用如下: What does sessionFactory.getCurrentSession() do? First, you can call it as many times and anywhere you like, once you get hold of your SessionFactory (easy thanks to HibernateUtil). The getCur…
在整合Spring4+hibernate4时候,当代码执行到dao中CRUD操作时,报了一个异常, org.hibernate.HibernateException: createQuery is not valid without active transaction ... 因为我用到的是session是通过sessionFactory.getCurrentSession()方法获得到的,这个session是和事务(transaction)绑定的,这个异常是告诉我,session的操作没有在…