-->
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: Beginer Query question
PostPosted: Thu Apr 29, 2004 12:39 pm 
Beginner
Beginner

Joined: Tue Feb 17, 2004 11:20 am
Posts: 28
Hi,

sorry for this really stupid question.
but after searching in the forum I could find anything I could use for my problem.

I have a parent-child relationship where there is many child or none

I would to get parent objects
where EITHER the parent.FLAG = 1
OR the any of the parents.child.FLAG = 1

I know in sql I would need an ALTER JOIN.
I just could figure out how I can do the same in HQL.

Thanks for any help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 1:01 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
select child.parent
from Child as child
where child.flag=1
or child.parent.flag=1

but give your mapping files it depends on your association


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 29, 2004 1:07 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
this can also work i think

select parent
from Parent parent, Child child
where parent.flag=1
or (child.flag = 1 AND child in elements(parent.childs))


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.