-->
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.  [ 1 post ] 
Author Message
 Post subject: hql and sql functions in group by
PostPosted: Sat Feb 26, 2005 6:37 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
release : last hibernate3 cvs (today)


I play with hql and group by and this query :

select substr(human.nickName,1,3),count(*)
from Human human
group by substr(human.nickName,1,3)

work with old parser, but doesn't work with new (AST) parser

I try next workaround in hql.g (line 332)

( "by"! expression ( COMMA! expression )* )?

except :

( "by"! path ( COMMA! path )* )?

and it work - query

select substr(human.name,1,3),count(*)
from Human human
group by substr(human.name,1,3)

work with new (AST) parser and my workaround , but doesn't work with old parser
(error is : path expression ends in a composite value: human0_.name [select substr(human.name,1,3),count(*)
from Human human
group by substr(human.name,1,3)]

Tests HQLTest return 14 failures and 1 error with and without my workaround.
test HqlParserTest is fine without my workaround and with return error :

HqlParserTest return error in test testPathologicalKeywordAsIdentifier
junit.framework.AssertionFailedError: At least one error occurred during parsing! expected:<0> but was:<2>

What I can do for query with sql functions in group by ?

regards
Peco


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

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.