10:49:11.312 [4] DEBUG NHibernate.Engine.Query.QueryPlanCache - unable to locate HQL query plan in cache; generating (Select b.Headline, concat(b.Creator.Name, ' ',b.Creator.SurName), b.Content, b.ID, b.CreateDate, count( elements(b.Entries) )
from cBlogEntry b left join b.Entries
group by b.Headline, concat(b.Creator.Name, ' ',b.Creator.SurName), b.Content, b.ID, b.CreateDate
)
SQL:
select cblogentry0_.Headline as x0_0_, (cuser2_.Name+' '+cuser2_.SurName) as x1_0_, cblogentry0_.Content as x2_0_, cblogentry0_.ID as x3_0_, cblogentry0_.CreateDate as x4_0_, count_big(entries3_.ID) as x5_0_ from tbBlogEntrys cblogentry0_ left outer join tbBlogComments entries1_ on cblogentry0_.ID=entries1_.BlogEntryID, tbUsers cuser2_, tbBlogComments entries3_ where cblogentry0_.Creator=cuser2_.ID and cblogentry0_.ID=entries3_.BlogEntryID group by cblogentry0_.Headline , (cuser2_.Name+' '+cuser2_.SurName) , cblogentry0_.Content , cblogentry0_.ID , cblogentry0_.CreateDate
You see it is almost there, for some reason a implicit join is done on tbBlogEntries. If I remove this then everything is fine. (ie.
select
cblogentry0_.Headline as x0_0_,
(cuser2_.Name+' '+cuser2_.SurName) as x1_0_,
cblogentry0_.Content as x2_0_,
cblogentry0_.ID as x3_0_,
cblogentry0_.CreateDate as x4_0_,
count_big(entries1_.ID) as x5_0_
from
tbBlogEntrys cblogentry0_
left outer join
tbBlogComments entries1_
on
cblogentry0_.ID = entries1_.BlogEntryID,
tbUsers cuser2_
where
cblogentry0_.Creator=cuser2_.ID
group by
cblogentry0_.Headline , (cuser2_.Name+' '+cuser2_.SurName) , cblogentry0_.Content , cblogentry0_.ID , cblogentry0_.CreateDate)
_________________ With respect,
Morten
|