|
The language is confusing me here, but I think you're doing the classic web app stuff: session1 gets something, passes it around a response/request scope mechanism, then it comes back into business logic, where session2 is available. At this point, you're in a different thread to session1, so you cannot use session1's cache/pointers/dereferencing code to figure out what SQL to use in order to get the missing data. You have to use session2 for that, because that's the only one you have.
If this is the scenario you're dealing with, then you must detach the object when session1 is done with it, even if session1 isn't closed. Then when the object is made available to session2, it can re-attach the object. Alternatively, you can do just as you are doing at the moment: fully initialize all lazy links so that you don't have to worry about other sessions in the future.
|