JSF + Spring + JPA + Hibernate: keep entitymanager object in render mode?

Brand new for Spring and Java development, but working on a project for a class with experienced developers. I believe that we use Spring MVC as our web layer (but I'm a C # guy, so I could be wrong in that regard). We have a view that gets an object with lazily loaded properties - pretty simple stuff. But when I call one of these properties in the JSF view, I get this error:

failed to lazily initialize a collection of role: xxxxxxxx, 
  no session or session was closed

which makes me think that the hibernation session closes too soon. Is there any way that one entitymanager remains alive throughout the entire request, including after sending the model to the view for rendering?

+3
source share
1 answer
+3
source

Source: https://habr.com/ru/post/1730759/


All Articles