I have two table
iProducts{iid,itypeid}
iProducttypes{typeid,typedesc}
sql query is
SELECT a.typeid,a.typedesc,ISNULL(b.icount, 0) AS icount
FROM iissuetypes a
LEFT OUTER JOIN
(SELECT itypeid, COUNT(*) AS icount FROM iProducts GROUP BY itypeid) b
ON a.typeid=b.itypeid
that returns me itypeid,typedesc and counts
I want to convert it into hibernate I am using following syntax
ProjectionList projections = Projections.ProjectionList(); projections = projections.Add(Projections.GroupProperty(itypeid),typeID);
projections=projections.Add(Projections.CountDistinct("iid"), "Count");
c.SetProjection(Projections.Distinct(projections));
it only returns itypeidand count
how I can change hibernate query so return the typedesc also.
I dont want to group by typedesc but just for displaying purpose I want typedesc
Please help!
|