What does NOT solve my issue:
- @Transactional annotation
- OpenSessionInViewInterceptor
The error message was:
HTTP ERROR 500
Problem accessing /user/1. Reason: Server Error
Caused by:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.HibernateException: collection is not associated with any session
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
Solution for Spring with JPA approach and EntityManager, is to use OpenEntityManagerInViewFilter. Register it in web.xml this way: