hibernate分组与聚合查询(hibernate groups and aggregate queries)

hibernate分组与聚合查询(hibernate groups and aggregate queries)

ID:36022735

大小:60.50 KB

页数:29页

时间:2019-04-28

hibernate分组与聚合查询(hibernate groups and aggregate queries)_第1页
hibernate分组与聚合查询(hibernate groups and aggregate queries)_第2页
hibernate分组与聚合查询(hibernate groups and aggregate queries)_第3页
hibernate分组与聚合查询(hibernate groups and aggregate queries)_第4页
hibernate分组与聚合查询(hibernate groups and aggregate queries)_第5页
资源描述:

《hibernate分组与聚合查询(hibernate groups and aggregate queries)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、hibernate分组与聚合查询(Hibernategroupsandaggregatequeries)Learningwebsite:http://blog.csdn.net/hardwin/article/details/4330912Hibernategroupingandaggregationqueries(nativeSQLandHQLusingcasewhenthenelseend)UsenativeSQLforqueriesusinghibernateTheviewplaincopytoclipboardprint?//serverdeploymentstati

2、sticsqueryclassIdcStatisticSpecPublicclassIdcStatisticSpecextendsAbstQueryStringSpec{/**machineroomID*/PrivateIntegercompLocaId;/**thestarttimeofthequeryPrivateDatebeginDate;/*****PrivateDateendDate;//omitgetsetPublicStringthequeryString(){StringBufferSQL=newStringBuffer("SELECTappcalledsim

3、plyMRL,app.OPERATION_ID,app.ThePRODUCT_ID,"+"sum"(if(cab.type='ONSHOW',1,0))asonshowNumber,""Sum"(if(cab.Type='WITHDRAW',1,0))as"Sum"(if(cab.Type='MOVE',1,0))asmoveNumber,""+"sum(cab.Type='WITHDRAW'andcab.reversion='RETURN',1,0))asreturnNumber"+"FROMchanage_applyapp,chanage_cabinetscab,chan

4、age_cabinets_executeexe"+"WHEREapp.Id=cab.APPLICATION_IDANDapp.id=exe.APPLICATION_ID"+"ANDapp.MRLisnotnullANDapp.mrl!=0"+"ANDapp.operation_idisnotnullANDapp.operation_id!=0"+"ANDapp.product_idisnotnullANDapp.product_id!=0"+"ANDexe.Attitude='Y'");If(QuerySpecUtil.Valid(compLocaId)){SQL.Appen

5、d("ANDapp.CalledsimplyMRL=:compLocaId");}If(QuerySpecUtil.Valid(beginDate)){SQL.Append("ANDexeEXECUTE_TIME>=:beginDate");}If(QuerySpecUtil.Valid(endDate)){SQL.Append("ANDexeEXECUTE_TIME<=:endDate");}SQL.Append("GROUPBYappcalledsimplyMRL,app.OPERATION_ID,app.ThePRODUCT_ID");ReturntheSQL.Thet

6、oString();}@OverrideProtectedvoidreset(){CompLocaId=null;BeginDate=null;EndDate=null;}}//serverdeploymentstatisticsqueryclassIdcStatisticSpecPublicclassIdcStatisticSpecextendsAbstQueryStringSpec{/**machineroomID*/PrivateIntegercompLocaId;/**thestarttimeofthequery私人beginDate日期;/**查询的结束时间*/私人

7、endDate日期;//省略得到设置公共字符串变量(){StringBuffersql=新的StringBuffer(“选择app.MRL、app.OPERATION_IDapp.PRODUCT_ID。”+sum(如果(cab.type='ONSHOW'1,0))作为onshowNumber“sum”(如果(cab.type='撤退',1,0))作为撤军的数量+sum(如果(cab.type='移动',1,0))作为moveNumber+"和(如果(出租车。类型='撤退'和cab.降级='返回',1,0

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。