+ -
当前位置:首页 → 问答吧 → hql--Unable to locate appropriate constructor on class

hql--Unable to locate appropriate constructor on class

时间:2011-11-28

来源:互联网

我想把数据进行统计,开始不太会做,写了测试的语句执行正确,如下:
select new CupBill (appID,serviceCode,wayID,sendCount,successCount,receiptCount,deliveryCount,bornDate) from CupBill where appID=112 group by appID,serviceCode,wayID,bornDate";

我实际是要将数据进行统计,然后再里面加了sum(),就报错,语句如下:
select new CupBill (appID,serviceCode,wayID,sum(sendCount),sum(successCount),sum(receiptCount),sum(deliveryCount),bornDate) from CupBill where appID=112 group by appID,serviceCode,wayID,bornDate";

报错如下:Unable to locate appropriate constructor on class [com.momentek.cup.mgmt2.bean.CupBill] [select new CupBill(appID,serviceCode,wayID,sum(sendCount),sum(successCount),sum(receiptCount),sum(receiptCount),bornDate) from com.momentek.cup.mgmt2.bean.CupBill where appID=112 group by appID,serviceCode,wayID,bornDate]

cupBill实体类中的构造方法如下:
public CupBill(int appID, String serviceCode, int wayID,
int sendCount, int successCount, int receiptCount,
int deliveryCount, int bornDate) {
super();
this.appID = appID;
this.serviceCode = serviceCode;
this.wayID = wayID;
this.sendCount = sendCount;
this.successCount = successCount;
this.receiptCount = receiptCount;
this.deliveryCount = deliveryCount;
this.bornDate = bornDate;
}

作者: define_ling   发布时间: 2011-11-28

开始正确的语句为:去掉后面的group by
"select new CupBill(appID,serviceCode,wayID,sendCount,successCount,receiptCount,deliveryCount,bornDate) from CupBill where appID=112";

作者: define_ling   发布时间: 2011-11-28

热门下载

更多