Hello,
Thanks ! I've never used CreateAlias before. So I gave it a go :
return SessionManager.GetCurrentSession()
.CreateCriteria(typeof (Post)).Add(Restrictions.Eq(Id, pId))
.CreateAlias(Post, po)
.SetFetchMode(po.thePublication, FetchMode.Eager)
Ok I have narrowed down the problem. The reason NH was doing the
extra selects is because I had not-found=ignore in the mapping.
I've removed that and I've let the default fetching strategy to
fetch=select.
Now let me show you what I try to do :
class Post
{
Publication thePublication
}
I've recently had similar problems with eager fetching and this was
worked for me:
return SessionManager.GetCurrentSession()
.CreateCriteria(typeof (Post)).Add(Restrictions.Eq(Id,
pId))
.SetFetchMode(thePublication, FetchMode.Eager)
.SetFetchMode(thePublication.theCountry,
try create alias and create criteria. You should set fetch mode on language
too.
Tuna Toksöz
Eternal sunshine of the open source mind.
http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike
On Thu, Apr 30, 2009 at 5:32 PM, graphicsxp