I'm developing a Java project with Visual Paradigm which I am required to use. Visual Paradigm is using Hibernate. My project was running fine until I've added Genady RMI. I'm also required to use RMI.
In the server side I've got MainDb which manages all the querys to the database and in the client side I've got UserWindow and AdminWindow classes which implements RMI Remote. Theses two classes get the object MainDb through RMI.
When I'm running the server and the client, I've got an exception related to Lazy initialization with the error "no session or session was closed":
failed to lazily initialize a collection of role: dcl.UsuarioRegistrado.ORM_TieneVideosFavoritos, no session or session was closed.
As far as I know, Hibernate is using a different session from which the dcl.UsuarioRegistrado object was created. The problem is that I'm not managing sessions because the class PersistentManager only provides getSession(). The class PersistentManager is the class provided by VisualParadigm to manage Hibernate.
I've tried configuring all the entitiies to lazy="false" but the result has been worse because properties from some entities were not loaded correctly. For instance an object "Topic" was loaded with the String property "TopicName" to null.
So, what could I do to maintain the same session?
Thanks in advance and I'm very sorry but my poor English. It's difficult for me to explain the situation in English so, again, thanks.