Lets say an application is broken into modules, each module exposing functionality via EJBs. If module A makes a call to an EJB method in module B which returns an object retrieved via Hibernate, then module A will not be able to call a lazy loading method of that object because the session is no longer there. How to handle this kind of situation?
Lets say an application is broken into modules, each module exposing functionality via EJBs.
Share
I came up with this final decision. Haven’t tried it yet but I think it will work. The problem was
If module A makes a call to an EJB method in module B which returns an object retrieved via Hibernate, then module A will not be able to call a lazy loading method of that object because the session is no longer there.
So in order to overcome this, module B will return only the primary key of the object and module A will retrieve the object via Hibernate. This way module A will be able to call lazy loaded methods of the object.