-->
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: JPQL - is not null in group by
PostPosted: Tue Oct 16, 2007 6:29 pm 
Newbie

Joined: Tue Oct 16, 2007 5:45 pm
Posts: 4
Location: Poland
I have to write a query, which expresses something like this:
Code:
SELECT f.a, COUNT(f.a), SUM(f.c), f.x IS NOT NULL
FROM Foo AS f
GROUP BY f.a, f.x IS NOT NULL" +
ORDER BY f.a, f.x IS NOT NULL DESC

The problem is is not null is not supported in the group by clause - I get "org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: is not null". The JPA documentation states that
Code:
groupby_clause ::= GROUP BY groupby_item {, groupby_item}*
groupby_item ::= single_valued_path_expression | identification_variable

and neither single_valued_path_expression nor identification_variable can contain the IS NOT NULL operator.

Is there any other possibility to express this in JPQL?


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.