select * from Index i inner join Order o on i.id = o.id where o.Status
= 4
AND (select count(*) from PPC where ppc.id = i.paperid) = 0


Not sure if it is correct but it should be something like this.

DetachedCriteria dc = DetachedCriteria.For<PPC>("ppc")
                     .Add(Restrictions.Eq("ppc.Id","i.Id"))
                    .SetProjection(Projections.Count());

IList<Index> papers = session
   .CreateCriteria(typeof(Index),"i")
   .CreateAlias("Order", "Order")
   .Add(Restrictions.Eq("Order.Status",4))
   .Add(Restrictions.Eq(Projections.Subquery(dc),0));

Gmail code so be aware :)

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

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




On Sat, May 2, 2009 at 8:13 PM, Smsgo <[email protected]> wrote:

>
> I’ve been looking for an example in “NHibernate In Action” and search

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