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.  [ 3 posts ] 
Author Message
 Post subject: HQL query failing on empty set
PostPosted: Tue Nov 28, 2006 8:51 am 
Newbie

Joined: Tue Apr 25, 2006 2:08 am
Posts: 7
Hi all,

I have a group object. This object has a set of images.

I use this query to load all the images in a group where the images in that group has a certain width:

from group where uuid=? and images.width=?

This works fine just as long as there are images in the group. If the group has no images, then this wont work. The list of groups is empty, so I tried:

from group where uuid=? and (images.width=? or images is null)

When that query is run I get all kind of hibernate exceptions. I've even tried

from group where uuid=? and (images.width=? or images.size == 0)

That throws exceptions too. All I want is that this query also includes groups who's image set is empty:

from group where uuid=? and images.width=?

It seams as if I cant call a set directly in HQL. If so how can I get a list of groups where the images set is empty?

Thanks in advance,
Martyn


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 9:04 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
I think an outer join can help you...

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 9:46 am 
Beginner
Beginner

Joined: Tue Nov 21, 2006 5:18 am
Posts: 31
Location: Bangalore, India
Hi,

Can you post your mapping file, I help you,

_________________
persist_coder
--credit please if it helps you


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.