HQL is far better suited for that query: select count(*) from User u join Company c join Contract ct where u.id='Link' and ct.id =10
The NH reference on NHForge.org has more on HQL and criteria queries. -Markus 2009/10/22 Bruno Leitão de Oliveira <[email protected]> > > I have the following case: > > one User has many companies > one Company has many Users > one Contract has one Company > > I need to know if the user 'link' belongs to the company contract with > code 10. > > Something like: > > count (1) from user_company uc, contract c where c.id = 10 and > c.id_company = uc.id_company and uc.id_user = 'link' > > The question is whether I can do this criterion with CreateAlias () or > CreateCriteria () traversing the graph. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
