unexpected token: ( near line 1, column 65

njuxfh 2014-03-17 04:21:05
hql代码如下:FieldUsage是我自定义的一个对象
String sql = "select new edu.nju.healthclub.model.FieldUsage(nnd,count(*))from"
+ "(select case"
+ " when age>=0 and age<=10 then '1-10' "
+ " when age>=11 and age<=20 then '11-20' "
+ " when age>=21 and age<=30 then '21-30' "
+ " when age>=31 and age<=40 then '31-40' "
+ " when age>=41 and age<=50 then '41-50' "
+ " when age>=51 and age<=60 then '51-60' "
+ " when age>=61 then '>60' "
+ " end as nnd from edu.nju.healthclub.model.Member) group by nnd";


报错
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ( near line 1, column 65 [select new edu.nju.healthclub.model.FieldUsage(nnd,count(*))from(select case when age>=0 and age<=10 then '1-10'  when age>=11 and age<=20 then '11-20'  when age>=21 and age<=30 then '21-30'  when age>=31 and age<=40 then '31-40'  when age>=41 and age<=50 then '41-50'  when age>=51 and age<=60 then '51-60'  when age>=61 then '>60'  end as nnd from edu.nju.healthclub.model.Member) group by nnd]
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:276)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168)


我的hql那里写错啦? 球大婶解答!!!
...全文
6025 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
你的from和(太紧凑了吧,应该有空格分割的。
njuxfh 2014-03-17
  • 打赏
  • 举报
回复
引用 1 楼 rui888 的回复:
,count(*) 先去掉试试呢。
没什么用处。。。
tony4geek 2014-03-17
  • 打赏
  • 举报
回复
,count(*) 先去掉试试呢。
2022 / 01/ 30: 新版esptool 刷micropython固件指令不是 esptool.py cmd... 而是 esptool cmd... 即可;另外rshell 在 >= python 3.10 的时候出错解决方法可以查看:  已于2022年发布的: 第二章:修复rshell在python3.10出错 免费内容: https://edu.csdn.net/course/detail/29666 micropython语法和python3一样,编写起来非常方便。如果你快速入门单片机玩物联网而且像轻松实现各种功能,那绝力推荐使用micropython。方便易懂易学。 同时如果你懂C语音,也可以用C写好函数并编译进micropython固件里然后进入micropython调用(非必须)。 能通过WIFI联网(2.1章),也能通过sim卡使用2G/3G/4G/5G联网(4.5章)。 为实现语音控制,本教程会教大家使用tensorflow利用神经网络训练自己的语音模型并应用。为实现通过网页控制,本教程会教大家linux(debian10 nginx->uwsgi->python3->postgresql)网站前后台入门。为记录单片机传输过来的数据, 本教程会教大家入门数据库。  本教程会通过通俗易懂的比喻来讲解各种原理与思路,并手把手编写程序来实现各项功能。 本教程micropython版本是 2019年6月发布的1.11; 更多内容请看视频列表。  学习这门课程之前你需要至少掌握: 1: python3基础(变量, 循环, 函数, 常用库, 常用方法)。 本视频使用到的零件与淘宝上大致价格:     1: 超声波传感器(3)     2: MAX9814麦克风放大模块(8)     3: DHT22(15)     4: LED(0.1)     5: 8路5V低电平触发继电器(12)     6: HX1838红外接收模块(2)     7:红外发射管(0.1),HX1838红外接收板(1)     other: 电表, 排线, 面包板(2)*2,ESP32(28)  

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧