-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL outer joins not working
PostPosted: Wed Aug 08, 2007 2:36 am 
Newbie

Joined: Tue Jul 03, 2007 7:34 am
Posts: 2
Hello,

Im workign on a HQL statement, where the working sql looks like:



Code:
SELECT DISTINCT(st.statusid)  ,
        st.fileid             ,
        st.refcd              ,
        st.eventdate          ,
        codeLevel2.description,
        codeLevel3.description,
        codeLevel4.description,
        st.provider           ,
        st.partial            ,
        st.totgw              ,
        st.totgwu             ,
        st.totpiece           ,
        st.activefl           ,
        st.fromcd             ,
        st.tocd               ,
        st.vessel             ,
        st.message1           ,
        st.message2           ,
        st.insertuser
FROM    ptcof_status   as st        ,
        gbd_statuscode as codeLevel1,
OUTER gbd_statuscode   as codeLevel2,
OUTER gbd_statuscode   as codeLevel3,
OUTER gbd_statuscode   as codeLevel4
WHERE   codeLevel1.statuslevel=1
    AND codeLevel2.statuslevel=2
    AND codeLevel3.statuslevel=3
    AND codeLevel4.statuslevel=4
    AND codeLevel2.code       =st.level2
    AND codeLevel3.code       =st.level3
    AND codeLevel4.code       =st.level4
    AND st.refcd              ='PEN582704'
    AND st.fileid             ='8885241'
ORDER BY st.eventdate


I mapped the two different tables ptcof_status and gbd_statuscode where ptcof_status is the main table and the gbd_statuscode is just a helping table to find out some labels for values.

I checked the hibernate documentation but it only shows joins on fields which exist with the same name on both tables (usually pk/fk's) which isnt the case in my example...

any ideas how i could solve the outer join issue?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 08, 2007 9:40 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
Are you saying that code is not the pk of the statuscode table but it is unique?


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