日期:2014-05-18 浏览次数:20686 次
StringBuilder sb = new StringBuilder("select new mybus.model.MRouterBaseCount( COUNT(");
sb.append(keyWord);
sb.append(") , ");
sb.append(keyWord);
sb.append(" ) from QuestionBase group by ");
sb.append(keyWord);
select new mybus.model.MRouterBaseCount( COUNT( bqDestinationArea ) , bqDestinationArea ) from QuestionBase group by bqDestinationArea
Hibernate:
select
count(questionba0_.bq_destination_area) as col_0_0_,
questionba0_.bq_destination_area as col_1_0_
from
mybus.question_base questionba0_
group by
questionba0_.bq_destination_area
{"resultValue":[{"keyCount":5,"keyName":"科创园区"},{"keyCount":3,"keyName":"游仙区"},{"keyCount":1,"keyName":"涪城区"},{"keyCount":1,"keyName":"警钟街"}],"totalValue":4}
//这是正确的结果(看图片可以知道)
select new mybus.model.MRouterBaseCount( COUNT( bqStartCommunity ) , bqStartCommunity ) from QuestionBase group by bqStartCommunity
Hibernate:
select
count(questionba0_.bq_start_community) as col_0_0_,
questionba0_.bq_start_community as col_1_0_
from
mybus.question_base questionba0_
group by
questionba0_.bq_start_community
{"resultValue":[{"keyCount":3,"keyName":"1s"}],"totalValue":1}
//这是错误的结果(看图片也可以知道)