日期:2014-05-17  浏览次数:20700 次

!!!问一个HQL 和SQL 的问题 SQL 可以跑 HQL 出问题!!!急!!
HQL 是这样的

SELECT u FROM Product u WHERE u.vvshop =true and u.commend = true and u.id in ( SELECT v.productId FROM (SELECT distinct rp.product.id,rp.recommendNum FROM RecommondProType rp where rp.recommondType in (:recommondTypes) and rp.warehouse=:warehouseId order by rp.recommendNum desc) v )?

SQL是可以跑 的
Java code

select *
  from (select product0_.ID                    as ID75_,
               product0_.name                  as name75_,
               product0_.smpic                 as smpic75_,
               product0_.marketPrice           as marketPr4_75_,
               product0_.brand                 as brand75_,
               product0_.brandName             as brandName75_,
               product0_.brandSerialNum        as brandSer7_75_,
               product0_.newAttributes         as newAttri8_75_,
               product0_.status                as status75_,
               product0_.model                 as model75_,
               product0_.properPayType         as properP11_75_,
               product0_.productClass          as product12_75_,
               product0_.memberPrice           as memberP13_75_,
               product0_.unit                  as unit75_,
               product0_.store                 as store75_,
               product0_.supplier              as supplier75_,
               product0_.parking               as parking75_,
               product0_.weight                as weight75_,
               product0_.volume                as volume75_,
               product0_.description2          as descrip20_75_,
               product0_.otherExplain2         as otherEx21_75_,
               product0_.howtobuy              as howtobuy75_,
               product0_.spec                  as spec75_,
               product0_.tags                  as tags75_,
               product0_.commend               as commend75_,
               product0_.dealerAdd             as dealerAdd75_,
               product0_.onlineSale            as onlineSale75_,
               product0_.tradingAmount         as trading28_75_,
               product0_.vvshop                as vvshop75_,
               product0_.booking               as booking75_,
               product0_.ifEntity              as ifEntity75_,
               product0_.getProductDay         as getProd32_75_,
               product0_.pinyinIndex           as pinyinI33_75_,
               product0_.no                    as no75_,
               product0_.marketing             as marketing75_,
               product0_.iternationalCode      as iternat36_75_,
               product0_.iternationalCodeNote  as iternat37_75_,
               product0_.adminusername         as adminus38_75_,
               product0_.companyname           as company39_75_,
               product0_.productlevel          as product40_75_,
               product0_.procurementuser       as procure41_75_,
               product0_.packagemodel          as package42_75_,
               product0_.productCountry        as product43_75_,
               product0_.productrovince        as product44_75_,
               product0_.productcity           as product45_75_,
               product0_.saletype              as saletype75_,
               product0_.productcolour         as product47_75_,
               product0_.recommendNum          as recomme48_75_,
               product0_.createDate            as createDate75_,
               product0_.publishDate           as publish50_75_,
               product0_.specialSize           as special51_75_,
               product0_.delChange             as delChange75_,
               product0_.purchasePrice         as purchas53_75_,
               product0_.specParameter         as specPar54_75_,
               product0_.proContentDetail      as proCont55_75_,
               product0_.afterSellService      as afterSe56_75_,
               product0_.presentBelong