-->
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: Group By Clause
PostPosted: Wed Aug 26, 2009 12:02 pm 
Newbie

Joined: Wed Aug 26, 2009 11:51 am
Posts: 1
Hi all,

I am looking for a solution to perform a particular HQL Query.
I would like to execute a Group by, on a collection size.

I got a class :
Code:
MyClass{
...
    Set<MyClass2> myCol ...
..
}


the query is like this :

Code:
select count(it.id), cCol is not null from MyClass it left join it.myCol as cCol group by (cCol is not null)


or

Code:
select count(it.id), cCol is empty from MyClass it left join it.myCol as cCol group by (cCol is empty)



I've discovered that I can't use "is not null" in the select clause, and that's the same for "is empty"

I got a "unexpected AST Node" exception with the both previous queries.


Is there a way to do this: get two groups of "MyClass", and differentiate on the facts the collection "myCol" is empty or not ?


Thanks in advance for your help.


Regards,

Farf


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.