I am trying to use Api criteria for multiple high-load tables.
My trimmed objects look like this:
class Limit { Risk {get; set;} } class Risk { List<Company> Companies { get;set;} } class Company { List<Address> OldAdresses {get;set;} } class Address { string Street { get;set;} }
The call to My Criteria is as follows:
var CriterionGruppe = Expression.Eq("Account.Id", someGuid); var temp = _transaktion.Session.CreateCriteria(typeof(Limit)) .SetFetchMode("Risk", FetchMode.Eager) .SetFetchMode("Risk.Companies", FetchMode.Eager) .Add(CriterionGruppe) .SetResultTransformer(new DistinctRootEntityResultTransformer()) .List<Limit>();
Addresses are still loaded by the Select set. How to include old company addresses in my criteria.
I already read the ayende blog post and a few other questions here on stackoverflow. But still no luck.
I hope someone can point me in the right direction.
Thanks in advance peter
When should we use downloads in NHibernate? What is this use?
NHibernate eagerly selects several levels
Ayende Blog
source share