session.CreateCriteria<Order>()
 .Add(Restrictions.Eq("this.Customer.Country","China"))
            .Add(Restrictions.GtProperty(

 DetachedCriteria.For<Order>("order")

 .Add(Restrictions.EqProperty("order.Customer","this.Customer"))

 .SetProjection(Projections.Count()))
                                                        ,0)))))))))))))))

like this, i think.

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Fri, Aug 7, 2009 at 10:49 PM, rg <[email protected]> wrote:

>
> Hi, I'm trying to use the Criteria api to query the database and have
> no problem with basic queries involving only 'root level' properties,
> that is direct attributes of the entity I'm querying for. But how to
> specify predicates on related entity attributes?
> For example: select all Orders where Customer is from China and has
> placed more than one order so far:
>
> select Order T where T.Customer.Country = 'China' and
> T.Customer.Orders.Count > 1
>
> can you translate it into the criteria API?
>
> R
> >
>

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