NHibernate - Retrieve specific columns and count using criteria querie
- by Cristian Sapino
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!