-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: problem with 'having' clause in query
PostPosted: Mon Jul 16, 2007 3:33 pm 
Newbie

Joined: Wed Apr 27, 2005 7:40 pm
Posts: 4
Hi,

It appears the hibernate libraries don't recognize a valid query with the 'having' clause. I'm using Hibernate 3.2.2.ga and Hibernate annotations 3.2.1.ga. Here is the error I get:
Code:
12:20:34,793 ERROR [org.hibernate.util.JDBCExceptionReporter] Not in aggregate function or group by clause:
COLUMN MERCHANTSC0_.SCORE_DATE in statement [select merchantsc0_.mid as mid2647_, merchantsc0_.score_date as score2_2647_, merchantsc0_.avg_Avail as avg3_2647_, merchantsc0_.avg_CustS as avg4_2647_, merchantsc0_.avg_Ease as avg5_2647_, merchantsc0_.avg_Info as avg6_2647_, merchantsc0_.avg_Likely as avg7_2647_, merchantsc0_.avg_OverAll as avg8_2647_, merchantsc0_.avg_Price as avg9_2647_, merchantsc0_.avg_PrRep as avg10_2647_, merchantsc0_.avg_Prvcy as avg11_2647_, merchantsc0_.avg_Select as avg12_2647_, merchantsc0_.avg_Ship as avg13_2647_, merchantsc0_.avg_Site as avg14_2647_, merchantsc0_.score_kind as score15_2647_ from merchant_score merchantsc0_ where merchantsc0_.mid=? group by merchantsc0_.mid having merchantsc0_.score_date=max(merchantsc0_.score_date)]
org.hibernate.exception.SQLGrammarException: could not execute query
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.doList(Loader.java:2214)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
        at org.hibernate.loader.Loader.list(Loader.java:2090)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)



Note that if I copy and paste the generated query above into my sql editor and run it in sybase, it works properly and returns data. Why doesn't hibernate think this is a valid query?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 6:36 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi


try this patch
http://opensource.atlassian.com/project ... e/HHH-1700

Amila

(Don't forget to rate if helps)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.