I need to process a large number of Person objects, each person object has a few lazy relations that I need to load in all at once.
I have created a batched temporary table with the Person ID's that I want:
Code:
PersonBatch {
Long personID;
int batchID;
}
I want to load in entire the object web for each Person in batches (so hibernate does not run out of memory).
Code:
Select P From Person P, PersonBatch T Where T.personID = P.id AND T.batchID = ?
This works fine, but I want to fetch join the optional relations that P might have. I'm trying to do:
Code:
Select P From Person P inner join PersonBatch T Where T.personID = P.id left fetch join P.friend left fetch join P.extraData
I can't seem to figure out the HQL that makes this work, anyone see a way to do it?