I have a rather large project involving spring and hibernate. Right now, I'm backing certain objects out of hibernate and into memory, and I've hit a sort of snag. I have the following setup.
Class A contains a number of primitives and a class B. B contains primitives and a class C, which was previously lazy-loaded.
Now I have this
Service call 1:
1.) create object of class A
2.) get object of class B
3.) set B in A
4.) add A to memory
Service call 2:
1.) get A from memory
2.) get B from A
3.) get C from B
4.) operate on C
Because C is lazy loaded, it relied on a hibernate session existing to lazily load itself from B with hibernate, at least I believe this to be so. Now, however, I need to lazy load without modifying the DAO to return an ID, and there exists no current hibernate session to hijack into with OpenSessionInView. What's the best way to go about solving this problem, given the limitations? The only solutions I've found rely on unsuitable code change or an existing session, so I think that I could perhaps manually open a hibernate session. How would I go about doing this? Alternatively, is there a better solution to this problem?