我有一张边storage 有个Ownerid外键约束User表
现在我要根据Ownerid分组,按Owner收到的礼物排序
oracle数据库
sql语言 select ownerid from storage group by ownerid order by count(gifti
d);用得HQL是String sql="select Ownerid from Storage group by Ownerid.userid order by count(giftid) desc";
出错
错误信息:Exception in thread "main" org.springframework.orm.hibernate3.HibernateQueryException: Invalid path: 'Ownerid.userid' [select Ownerid from entity.Storage group by Ownerid.userid order by count(giftid) desc]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'Ownerid.userid' [select Ownerid from entity.Storage group by Ownerid.userid order by count(giftid) desc]
Caused by: org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'Ownerid.userid' [select Ownerid from entity.Storage group by Ownerid.userid order by count(giftid) desc]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)Hibernate配置:
<many-to-one name="Ownerid" class="entity.User" fetch="select" lazy="false">
<column name="OWNERID" precision="22" scale="0" />
</many-to-one>请帮忙解决,很急啊
现在我要根据Ownerid分组,按Owner收到的礼物排序
oracle数据库
sql语言 select ownerid from storage group by ownerid order by count(gifti
d);用得HQL是String sql="select Ownerid from Storage group by Ownerid.userid order by count(giftid) desc";
出错
错误信息:Exception in thread "main" org.springframework.orm.hibernate3.HibernateQueryException: Invalid path: 'Ownerid.userid' [select Ownerid from entity.Storage group by Ownerid.userid order by count(giftid) desc]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'Ownerid.userid' [select Ownerid from entity.Storage group by Ownerid.userid order by count(giftid) desc]
Caused by: org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'Ownerid.userid' [select Ownerid from entity.Storage group by Ownerid.userid order by count(giftid) desc]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)Hibernate配置:
<many-to-one name="Ownerid" class="entity.User" fetch="select" lazy="false">
<column name="OWNERID" precision="22" scale="0" />
</many-to-one>请帮忙解决,很急啊
解决方案 »
- ibatis 关于count(*)查询问题
- java 编写入库单编号
- java 实现图片锐化功能
- struts的问题
- struts问题:一个表单里面,多个按钮,实现不同功能
- 关于在EJB中调用EJB的问题
- soap接口请求返回 Read timed out和Connection reset
- Classpath的困惑!----希望能够解决类找不到的问题。建议加入精华区。
- 谁有基于J2EE的进销存系统的需求分析(实例),邮给我一份。
- 关于j2ee server中的web server
- 非常急,在线等!!socket发送HTTP请求测试webservice性能无法同时发送多个HTTP请求的问题
- axis2客户端调用异常
都不对啊,说不是group by表达式
或者你直接调用sql语句就是了,getSession().createSQLQuery(sql语句)