Note that there are some explanatory texts on larger screens.

plurals
  1. POEager Fetching with nhibernate Criteria API
    primarykey
    data
    text
    <p>I am trying to use the criteria Api over multiple tables with eager loading.</p> <p>My stripped-down Entities look like this:</p> <pre><code>class Limit { Risk {get; set;} } class Risk { List&lt;Company&gt; Companies { get;set;} } class Company { List&lt;Address&gt; OldAdresses {get;set;} } class Address { string Street { get;set;} } </code></pre> <p>My Criteria call looks like this:</p> <pre><code>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&lt;Limit&gt;(); </code></pre> <p>The addresses are still loaded with many Selects. How can I include the old adresses of a Company in my criteria call.</p> <p>I already read a blog entry in ayende's blog and several other question here at stackoverflow. But still had no luck.</p> <p>I hope someone could point me in the right direction.</p> <p>Thanks in advance peter</p> <p><a href="https://stackoverflow.com/questions/2989058/when-must-we-use-eager-loading-in-nhibernate-what-is-its-usage">When must we use eager loading in NHibernate? What is it's usage?</a></p> <p><a href="https://stackoverflow.com/questions/332703/nhibernate-eager-fetching-over-multiple-levels">NHibernate Eager Fetching Over Multiple Levels</a></p> <p><a href="http://ayende.com/blog/4367/eagerly-loading-entity-associations-efficiently-with-nhibernate" rel="nofollow noreferrer">Ayende Blog</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload