You can use subquery projection with detached criteria. 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, May 1, 2009 at 1:41 PM, Smsgo <[email protected]> wrote: > > Hi, > > I need a little help with creating an ICriteria query from a SQL > statement. I've got the following SQL statement correctly implemented > as an ICriteria. > > SQL: > select * from Index i inner join Order o on i.id = o.id where > o.Status = 4 > > NHibernate: > IList<Index> papers = session > .CreateCriteria(typeof(Index)) > .CreateAlias("Order", "Order") > .Add(NHibernate.Criterion.Expression.Eq("Order.Status", 4)) > .List<Index>(); > > > But how is it possible to add a subquery like this? > > SQL: > 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 > > Thank you for taking the time to read my question :-) > > Best regards > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
