Hibernate Session is closed
You can use this annotation on your controller method:
@Transactional(readOnly = true)
Update: I guess that calling getCurrentSession()
does not guarantee that the session is actually open. For the very first time, you should use
Session session = this.getSessionFactory().openSession();
session.beginTransaction();
instead. This suggestion is actually consistent with the page you found.
Earlier:
Based on the information available so far, we can conclude that the cause of the error is the session not being open ;-)
I think I found the answer in:
Session is Closed
I am yet to implement it