Hi All !
I'm Krishna. I'm working with Hibernate Criteria queries. I'm writing Group By query. I dont know how to apply Restrictions for Gruop By clause.
Anyone know how to write having clause in Criteria Group By Projections.
My code is like this:
List statusList1=session.createCriteria(Division.class,"divn")
.createCriteria("companyProfiles","company")
.add(Restrictions.eq("companyId", companyId))
.createCriteria("divn.divisionCostCenters", "divisionCostCenter")
.createCriteria("costCenter","cc")
.createCriteria("expenseReports", "report")
.createCriteria("expenseReportStatuses", "ers")
.add(Restrictions.between("modifiedDate",stDate,edDate))
.setProjection( Projections.distinct(Projections.projectionList()
.add(Projections.groupProperty("divn.divisionId"))
.add(Projections.groupProperty("report.costCenter.costCenterId"))
.add(Projections.property("divn.divisionName"))
.add(Projections.property("cc.costCenterName"))
.add(Projections.count("report.currentStatus.statusId").as("1"))
.add(Projections.count("report.currentStatus.statusId").as("2"))
.add(Projections.count("report.currentStatus.statusId").as("3")) ))
Here I have differnt statusIds sach as 1,2,3.
I want to display satusId with 1 in 1 column, 2 in another column and so on.
I wrote till here, but couldn't find the solution.
Can anybody suggest me a way please ?
Thanking you,
Krishna
[/b]
_________________ Ch. Krishna Reddy
|