hibernate中select count(*) from (select new map())as lin 为什么报错
我做了一个查询 把查出来的 东西 变成一个map 已经出来了 但是我想加一个分页 就是不好使
我的分页是 封好的 以前都是 只传一个sql 语句就可以 但是现在报错
Java code
this.setHql("from (select new map(a1.name as aa1 ,a2.name as aa2,a3.name as aa3,c.customersname as bb,b.name as name,b.customer_Name as customer_Name,b.account_Manager as account_Manager,b.clients as clients,b.prosection1 as prosection1,b.prosection2 as prosection2,b.prosection3 as prosection3,b.dotime as dotime,b.incometime as incometime,b.itembudget as itembudget,b.remark as remark) from Pro_segmentDomain as a1,Pro_segmentDomain as a2,Pro_segmentDomain as a3,Item_trackDomain as b ,Customers as c where a1.id=b. prosection1 and a2.id=b. prosection2 and a3.id=b. prosection3 and b.clients=c.customersid)as zz");
后台报这个错
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 22 [select count(*) from (select new map(a1.name as aa1 ,a2.name as aa2,a3.name as aa3,c.customersname as bb,b.name as name,b.customer_Name as customer_Name,b.account_Manager as account_Manager,b.clients as clients,b.prosection1 as prosection1,b.prosection2 as prosection2,b.prosection3 as prosection3,b.dotime as dotime,b.incometime as incometime,b.itembudget as itembudget,b.remark as remark) from com.project.domain.daima.Pro_segmentDomain as a1,com.project.domain.daima.Pro_segmentDomain as a2,com.project.domain.daima.Pro_segmentDomain as a3,com.project.domain.Item_trackDomain as b ,com.client.domain.Customers as c where a1.id=b. prosection1 and a2.id=b. prosection2 and a3.id=b. prosection3 and b.clients=c.customersid)as zz]
简单点说 就是 我想select count(*) from 一个 new map 为什么不可以!!
谢谢 各位了
------解决方案--------------------看看这个。http://hi.baidu.com/tianfu_xue/blog/item/e16b1e1fdc8b620d314e15e4.html
------解决方案--------------------from (select new map(a1.name as aa1 ,a2.name as aa2,a3.name as aa3,c.customersname as bb,b.name as name,b.customer_Name as customer_Name,b.account_Manager as account_Manager,b.clients as clients,b.prosection1 as prosection1,b.prosection2 as prosection2,b.prosection3 as prosection3,b.dotime as dotime,b.incometime as incometime,b.itembudget as itembudget,b.remark as remark) from Pro_segmentDomain as a1,Pro_segmentDomain as a2,Pro_segmentDomain as a3,Item_trackDomain as b ,Customers as c where a1.id=b. prosection1 and a2.id=b. prosection2 and a3.id=b. prosection3 and b.clients=c.customersid)as zz
改为
from (select new map(a1.name as aa1 ,a2.name as aa2,a3.name as aa3,c.customersname as bb,b.name as name,b.customer_Name as customer_Name,b.account_Manager as account_Manager,b.clients as clients,b.prosection1 as prosection1,b.prosection2 as prosection2,b.prosection3 as prosection3,b.dotime as dotime,b.incometime as incometime,b.itembudget as itembudget,b.remark as remark)from Pro_segmentDomain as a1,Pro_segmentDomain as a2,Pro_segmentDomain as a3,Item_trackDomain as b ,Customers as c where a1.id=b. prosection1 and a2.id=b. prosection2 and a3.id=b. prosection3 and b.clients=c.customersid)as zz
无空格看看