NHibernate - Retrieve specific columns and count using criteria querie

Posted by Cristian Sapino on Stack Overflow See other posts from Stack Overflow or by Cristian Sapino
Published on 2010-03-22T15:24:45Z Indexed on 2010/03/22 21:31 UTC
Read the original article Hit count: 365

Filed under:
|
|

This is my mapping file:

This is the other with joined-subclass

class name="CRMStradCommon.Entities.ContactoEntity,CRMStradCommon" table="contacto" dynamic-update="true">

Haw can I make this query with Criteria?

SELECT contacto.id, contacto.nombre, persona.apellido, COUNT(*) AS Cant FROM contacto INNER JOIN oportunidad ON contacto.id = oportunidad.dueno LEFT OUTER JOIN persona ON contacto.id = persona.id LEFT OUTER JOIN empresa ON contacto.id = empresa.id GROUP BY contacto.id, contacto.nombre, persona.apellido ORDER BY contacto.nombre, persona.apellido

Thanks a lot!

© Stack Overflow or respective owner

Related posts about c#

Related posts about nhibernate