A topic of many previous questions I see - but not quite as this one however. I understand Hibernates lazy fetching strategies, open-session-in-view etc., but I cant seem to find the solution to this simple little thing, where my association is fetched lazily no matter what.
I am not using open session in view, as my web-app was build without it, and is now to complex to "migrate"...
Let's say we have a chain of references, say a <- b <- c <- d -> e
More often than not, fetching a also means we need b, c and d. So these are set to be always eagerly fetched (by specifying lazy=false in the hibernate mapping file). This WORKS!!
However, we now also need to always eagerly fetch the association e, everytime d is fetched. Since e is crucial to perform some logic operations on d.
And this is where it stops working... e is associated with d as a many-to-one association on d. Setting this to lazy=false doesn't do the trick, it is still not properly initialized, and accessing properties on e from d causes LazyInitialisationException.
Is it wrong of me to expect that this would work? The lazy property is specified in the hbm files using hibernate v. 3.2.6 and Spring version 2.5.6.
Hope someone can clarify things for me...
By all means, please refer to another post if you find one. I cant seem to find one covering this...