[nhusers] Re: hibernate is doing too many SELECT

2009-05-01 Thread graphicsxp
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)

[nhusers] Re: hibernate is doing too many SELECT

2009-05-01 Thread graphicsxp
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 }

[nhusers] Re: hibernate is doing too many SELECT

2009-05-01 Thread Nick Nguyen
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,

[nhusers] Re: hibernate is doing too many SELECT

2009-04-30 Thread Tuna Toksoz
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