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: problem in right outer join fetch
PostPosted: Fri Dec 14, 2007 4:32 am 
Newbie

Joined: Tue Aug 28, 2007 3:18 am
Posts: 13
Hi ,

I have 3 tables. LKUP , TKT_QST_ACTN and TKT.
TKT_QST_ACTN have foreign key reference of LKUP through LKUP_ID.
and TKT_QST_ACTN have also foreign key reference of TKT through TKT_NO

Now I have to retrieve all the tktQstActn objects for a particular ticket number by joining lkup on lkup.typ.
It is possible that TKT_QST_ACTN dont have all the reference of LKUP_ID for a particular TKT_NO.
But I have to retrieve all the LKUP_ID also for that TKT_NO.

my HQL IS ::

from TktQstActn tqs right join tqs.lkup lk where lk.typ in
('X' , 'Y')


It retrieves object array with first element of tktQstActn and second element as lkup. It retrieves null tktQstActn with valid lkup reference.

but when I want to fetch tktQstQctn for a particular ticket with following query it RETRIEVES ONLY that rows that have a reference with lkup .

HQL is :
from TktQstActn tqs right join tqs.lkup lk where lk.typ in
('X' , 'Y') and tqs.tkt.tktNo = '5'


I am using Eclipse 's hibernate tool to see my result.

Can Anyone please throw some light

on how can i retrieve all the tktQstActn objects having reference + not having reference with lkup object for a paarticular ticket number .....


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 16, 2007 7:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
This is the tools forum. Try the user forum.

BTW: Hint - tqs.tkt.tktNo causes another join which might not be working the way you want it to be - be explicit about what you want to happen.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 17, 2007 2:33 am 
Newbie

Joined: Tue Aug 28, 2007 3:18 am
Posts: 13
Thanks... David,

after posting the topic I realized that I have posted it in wrong forum. Then I posted again in user forum. But may be due to spelling mistake in subject line no reply has came yet.


Actually Lkup is a master table.It contains different questions.TkeQstActn contain answers of those questions for different ticket number.But there is a catch.

Suppose for tkt no 3 user gives 7 answers out of 10 questions of Lkup table.So Only 7 row inserts into tktQstQctn table.

Now in Query I have fetch all the 10 rows of Lkup+tktQstn rows for tkt 3.

so I am going for right outer join but not able to fetch the intended results .

Can you please throw some light on it.


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.