Almost there to getting an initial conversion of our persistence infrastructore over to Hibernate...
But, I'm totally stuck now. I'd just assumed this was possible, and now that I'm to the point I can actually try to do it, I cannot seems to figure it out. It's a problem about loading a subset graph instead of the full object graph.
I only post because I'm at my wits end, I've spent better part of today scanning the manual, all the FAQs, and searching the forums for some idea of a solution (or at least explanation).
Let me provide a simple example. Given the following kind of model:
A 1:m B (A has 1:m relation to B)
B 1:m C (B has 1:m relation to C)
Assume POJOs with appropriate collection properties for these relations (middlegen + hbm2java). All relations are defined to be lazy=true.
The full object graph is then defined as (using inner joins)...
Given an A, load all B related to that A, and load all C related to each B.
There are various ways of loading this graph, Hibernate has tons of support for this. No problems here!
But, I want to be able to get a subset of this object graph, say...
Given an A satsifying condition Q1, load all B related to that A satisfying condition Q2, and load all C related to each such B satisfying condition Q3.
And I want this in the exact same POJO model already defined.
I'm able to load A, and I'm trying to use 'join fetch' to go from A -> B, but I cannot do the same from B -> C (current limitation of Hibernate, 1 fetch per query). The documenation also says I should not (cannot?) use a WHERE clause, but the SQL seems to use it.
Now, even if I partially load this graph up. As soon as I try to use A->B, an initialization occurs (I've defined all relations to be lazy=true, per recommendations).
Ideas?
--gus