java.lang.IllegalStateException异常问题

Lsoxi2009 2008-06-29 03:29:59
String sql="from ProductOrdersInfo p where p.id in (select min(id) from ProductOrdersInfo po where po.memberInfo.id=? and po.state=? group by po.code) ";
这条sql语句有什么问题吗
运行时报:
警告: Unhandled Exception thrown: class java.lang.IllegalStateException
2008-6-29 15:23:49 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.AggregateNode
\-[AGGREGATE] AggregateNode: 'min'
\-[IDENT] IdentNode: 'id' {originalText=id}
...全文
1928 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
fjbadm 2010-09-07
  • 打赏
  • 举报
回复
我也是java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.IdentNode
\-[IDENT] IdentNode: 'userName' {originalText=userName}
跑跑鱼 2010-05-23
  • 打赏
  • 举报
回复
回 帖
tang52016639 2008-07-14
  • 打赏
  • 举报
回复
解决了没啊?这是什么原因?
我一遇到同样的问题
from Sysuser sy where sy.userid=(select MAX(cast(s.userid as int) ) from Sysuser s)
这句在HQL Editor中能执行,但加在DAO中就报错

javax.servlet.ServletException: No data type for node: org.hibernate.hql.ast.AggregateNode
\-[AGGREGATE] AggregateNode: 'MAX'
\-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'cast' {originalText=cast}
\-[EXPR_LIST] SqlNode: 'exprList'
+-[DOT] DotNode: 'sysuser1_.USERID' {propertyName=userid,dereferenceType=4,propertyPath=userid,path=s.userid,tableAlias=sysuser1_,className=com.stategrid.aostar.web.model.Sysuser,classAlias=s}
| +-[ALIAS_REF] IdentNode: 'sysuser1_.USERID' {alias=s, className=com.stategrid.aostar.web.model.Sysuser, tableAlias=sysuser1_}
| \-[IDENT] IdentNode: 'userid' {originalText=userid}
\-[IDENT] IdentNode: 'int' {originalText=int}
bobor_2008 2008-07-02
  • 打赏
  • 举报
回复
No data type for node: org.hibernate.hql.ast.AggregateNode
\-[AGGREGATE] AggregateNode: 'min'
\-[IDENT] IdentNode: 'id' {originalText=id}




和楼上朋友的看法一样,你加上别名试试吧.
Shine_Panda 2008-06-29
  • 打赏
  • 举报
回复
(select min(id) from
明确注明是那个对象的id
zfg2003 2008-06-29
  • 打赏
  • 举报
回复
String sql="from ProductOrdersInfo p where p.id in (select min(id) from ProductOrdersInfo po where po.memberInfo.id=? and po.state=? group by po.code) ";

这样?:
String sql="from ProductOrdersInfo p where p.id in (select min(po.id) from ProductOrdersInfo po where po.memberInfo.id=? and po.state=? group by po.code) ";
Lsoxi2009 2008-06-29
  • 打赏
  • 举报
回复
sql语句我放在查询器执行是没问题的,,,在写在DAO的方法里就出问题了
zhj92lxs 2008-06-29
  • 打赏
  • 举报
回复
min(id)这个id也用 别名.id 试试
Lsoxi2009 2008-06-29
  • 打赏
  • 举报
回复
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="identity"> </generator>
</id>

有啊,,,
Lsoxi2009 2008-06-29
  • 打赏
  • 举报
回复
<id name="id" type="java.lang.Integer">
<column name="id" />
<generator class="identity"></generator>
</id>

有啊,,,
老紫竹 2008-06-29
  • 打赏
  • 举报
回复
'id' 没有设置数据类型,去看看你的配置文件

67,513

社区成员

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

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