Điều gì đã xảy ra với phương thức SessionFactoryUtils.getSession từ Hibernate 4 trong Spring 3.1.0? Những gì nên được sử dụng thay thế? sessionFactory.getCurrentSession() giữ cho tôi ngoại lệ này:Mùa xuân: Tại sao lớp SessionFactoryUtils trong Hibernate 4 không cung cấp phương thức getSession?
org.hibernate.HibernateException: No Session found for current thread
at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97)
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:883)
Bất kỳ gợi ý nào?
Tôi đang đối mặt với cùng một vấn đề, tôi đang sử dụng sessionFactory.getCurrentSession() thay vào đó, nhưng tôi không chắc chắn nếu nó là đúng cách để đi. – craftsman