Hi,
I have a multi query problem, where i load several children, but somehow the order changes things.
These are the list of children i try to prefetch:
ptb.AfviklingsProfil.AfviklingsElementer
ptb.Renteprofil.RenteElementer
ptb.Vilkår.Indfrielsesvilkår.Indfrielsesvilkårelementer
This is the query:
Code:
string hqlPtb =
"from Pantebrev ptb join fetch ptb.RenteProfil renteprofil join fetch renteprofil.RenteElementer join fetch ptb.FremtidigAmortiseringsplan where ptb.Oid = " +
oid;
string hqlPtbVilkår =
"from Pantebrev ptb join fetch ptb.Vilkår.Indfrielsesvilkår join fetch ptb.Vilkår.Indfrielsesvilkår.Indfrielsesvilkårelementer where ptb.Oid = " + oid;
string hqlPtbAmortplan =
"from Pantebrev ptb join fetch ptb.AfviklingsProfil join fetch ptb.AfviklingsProfil.AfviklingsElementer where ptb.Oid = " + oid;
var result = Context.Current.Session.CreateMultiQuery().
Add(hqlPtb).
Add(hqlPtbVilkår).
Add(hqlPtbAmortplan).
List();
IPantebrev ptb = (IPantebrev)((ArrayList)result[0])[0];
The elements ptb.AfviklingsProfil.AfviklingsElementer only fetches 1, even though i can see the resulting sql gets 2 from the database.
So somehow NHibernate doesn't get ptb.AfviklingsProfil.AfviklingsElementer inserted correct into the object tree.
If i only execute
Code:
var result = Context.Current.Session.CreateMultiQuery().
Add(hqlPtbAmortplan).
List();
It fetches 2 ptb.AfviklingsProfil.AfviklingsElementer
Why is this? Anyone knows? Why does it only get 1 ptb.AfviklingsProfil.AfviklingsElementer if i do the large composed multiquery?
Regards,
CSky