Hi
I'm trying to quering a list of Paper objects join with a row count
from PaperDownloads.
The code below is resolving in a list the the row count, but the Paper
obj's are not included.
Do you have any suggestions?
DetachedCriteria detac = DetachedCriteria.For(typeof
(PaperDownloads), "PD")
.Add(Expression.EqProperty("PaperId", "Paper.Id"))
.SetProjection(Projections.Count("PD.Id"));
ICriteria criteria = GetSession()
.CreateCriteria(typeof(Papers), "Paper")
.SetMaxResults(500)
criteria.SetProjection(Projections.Alias
(Projections.SubQuery(detac),"myAlias"));
var abc = criteria.List();
SQL:
SELECT top 500 (SELECT count(this_0_.id) as y0_ FROM PaperDownloads
this_0_ WHERE this_0_.PaperId = this_.Id) as y0_ FROM Papers this_
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---