It is not supported as there is no EntityProjection implemented.You can try
with HQL



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, Jul 16, 2009 at 3:16 PM, Smsgo <[email protected]> wrote:

>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to