I have created a class in which I have set some of it’s fields (other entities) to be LAZY loaded. Now I need to use this object after it has been detached from the session, so I obviously need to make sure all the fields that I need are populated before detaching it. I tried just calling the getters to these lazy fields but that didn’t seem to work. Anyone have an idea how to force these fields to be loaded?
Share
will force-initialize the object/collection that is passed to it. You need an active session for this.
If the entity is detached, you’d have to re-attach the object (using
merge(..)) to an active session and then initialize it.