Hi, I'm working on a POC for a very large project, but we're having issues with object detachment:
Suppose you have:
Code:
Object A
+collection(B) // lazy loaded
+collection(C) // lazy loaded
basically an object with more than one collection.
Now, using Criteria, try to get a list of A objects that are complete (both collections have been loaded) and detached. For one collection, this is easy to do with setFetchMode("Bs",FetchMode.JOIN). But, there seems to be no way to do this with the collection of Cs as well.
Setting FetchMode.JOIN twice is ignored because of Cartesian product issues. FetchMode.SELECT does a secondary select (to be expected), but this is
not done eagerly, so you get a LazyLoadingException anyway.
I've really thouroughly researched this (forum, TFM, Wiki, google and several stabs at the Hibernate source code), but to no avail. Because all the lazy loading is "hidden away" behind the proxying code, it doesn't seem like there's an easy hack anyway.