return em.createQuery("""
select priority, Tube, Shelf, Snd, Notion FROM (
select c.id, CASE WHEN c.priority between 1 and 10 then '1-10'
WHEN c.priority between 11 and 20 then '11-20'
WHEN c.priority between 21 and 30 then '21-30'
WHEN c.priority between 31 and 40 then '31-40'
WHEN c.priority between 41 and 50 then '41-50'
WHEN c.priority between 51 and 60 then '51-60'
WHEN c.priority between 61 and 70 then '61-70'
WHEN c.priority between 71 and 80 then '71-80'
WHEN c.priority between 81 and 90 then '81-90'
WHEN c.priority between 91 and 100 then '91-100' end as Priority,
s.description
from CountEntity c, SkillEntity s, SkillTypeEntity t
where t.id=6 and t.id=s.skillType and c.skill=s.id )
Pivot
(
count(id) for description in ('Shelf Count' as Shelf, 'Notion Count' as Notion, 'Tube Count' as Tube, '2nd Count' as Snd)
)
Order by 1 """).getResultList()
当我运行SQL时,SQL查询在SQL开发人员上运行正常。但是同样的SQL查询在Hibernate中抛出了这个错误。以下是错误。
错误从这里开始***
在异常org.hibernate.hql.ast.QuerySyntaxException中:意外令牌:( 靠近第2行第80列[
select priority, Tube, Shelf, Snd, Notion FROM (
select c.id, CASE WHEN c.priority between 1 and 10 then '1-10'
WHEN c.priority between 11 and 20 then '11-20'
WHEN c.priority between 21 and 30 then '21-30'
WHEN c.priority between 31 and 40 then '31-40'
WHEN c.priority between 41 and 50 then '41-50'
WHEN c.priority between 51 and 60 then '51-60'
WHEN c.priority between 61 and 70 then '61-70'
WHEN c.priority between 71 and 80 then '71-80'
WHEN c.priority between 81 and 90 then '81-90'
WHEN c.priority between 91 and 100 then '91-100' end as Priority,s.description
from CountEntity c, SkillEntity s, SkillTypeEntity t
where t.id=6 and t.id=s.skillType and c.skill=s.id )
Pivot
(
count(id) for description in ('Shelf Count' as Shelf
,'Notion Count'为Notion,'Tube Count'为Tube,'2nd Count'为Snd) ) 订购1]
ERROR msg在此结束****
有人可以帮忙吗?