-->
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 in-clause
PostPosted: Mon Jan 14, 2008 10:13 am 
Newbie

Joined: Mon Jan 14, 2008 9:57 am
Posts: 5
hi,

i am trying to make an HQL Query which use an in-clause.

The Database is defined as follows:
There is a many-to-many relation from the ChangeAlert to Change.
A datamember ("changes") is defined (in the java source) from ChangeAlert to Change only ! no other direction (from Change to ChangeAlert)

The query i try to write is something like the following:
select c from Change c, ChangeAlert a where c in a.changes

explanation on the query:
return all the Changes which have alerts "pointing" to the them (the in statement).

but it doesnt work...

the HQL Editor give the following sql statement:


select
change0_.ID as ID64_,
.....
from
CCM_CHANGES change0_,
CCM_ALERT changealer1_,
CCM_ALERTSCHGS changes2_,
CCM_CHANGES change3_
where
changealer1_.ALERT in (
'CHANGE_ALERT', .... )
and changealer1_.ID=changes2_.ALERT_ID
and changes2_.CHANGE_ID=change3_.ID
and (
change0_.ID in (
.
)
)


does anybody know how to solve this problem ??
Thanks !


Top
 Profile  
 
 Post subject: Re: HQL in-clause
PostPosted: Mon Jan 14, 2008 1:44 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
oved wrote:
explanation on the query:
return all the Changes which have alerts "pointing" to the them (the in statement).



How about this:


Code:
select c from ChangeAlert a inner join a.changes c




Farzad-


Top
 Profile  
 
 Post subject: it worked !!! thank u very much :-)
PostPosted: Tue Jan 15, 2008 8:11 am 
Newbie

Joined: Mon Jan 14, 2008 9:57 am
Posts: 5
..


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.