Hi,
i am facing the issue with group by in hibernate criteria. i stored date field values in db like this
val_dt ------- 15-05-12 15-05-12 20-05-12 20-05-12
I need to get group by using "month" but not by date. when i am executing the below code i am getting the below issue.
getPostDatedChequeSummary(PDCEnquiryInfo info) {
List<String> acctList = info.getAccountNumber(); List<String> custList = info.getCustomerId();
Criteria criteria =session.createCriteria(FbpPostDtdCheq.class); criteria.add(Restrictions.in("id.custId", custList)); -----> here i am passing multiple customer id values criteria.add(Restrictions.between("valDt", fromDate, toDate)); criteria.add(Restrictions.in("fbpOwnAcct.id.acctId", acctList)); List<String> acctList = info.getAccountNumber();
criteria.setProjection(Projections.sqlGroupProjection( "month({alias}.val_dt) as month", "month({alias}.val_dt)", new String[] {"month"}, new Type[] {Hibernate.STRING}));
criteria.setProjection(projectionList);
}
when i am executing the above code i am getting the below error :
Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "MONTH": invalid identifier
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
please give me suggestion....
|