-->
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.  [ 1 post ] 
Author Message
 Post subject: Theta Style Left Outer Join in HQL
PostPosted: Thu May 31, 2012 7:07 am 
Newbie

Joined: Thu May 31, 2012 7:03 am
Posts: 1
(I know odds are against a response, but I figured I'd try anyways)

I have the following SQL query that I am attempting to convert to HQL. Unfortunately, outer joins have never been my favorite to deal with.

Code:
SELECT DISTINCT T_EMPLOYEE.SSN,   
     T_EMPLOYEE.TRANSACTION_ID,   
     T_EMPLOYEE.NAME,   
     T_EMPLOYEE.CANCEL_DATE,   
     T_EMPLOYEE.CAN_USERID,   
     T_DEPARTMENT.LOC FROM T_EMPLOYEE,   
     T_DEPARTMENT 
WHERE ( T_EMPLOYEE.DEPARTMENT_CODE = T_DEPARTMENT.CODE (+)) and 
     ( ( T_EMPLOYEE.SSN = :s_ssn ) ) 


I know the (+) symbol on the right of the where is Oracle's old style outer join sequence (and since it's on the right its a left outer join). There is also no foreign key relationship between T_EMPLOYEE and T_DEPARTMENT (legacy database). Right now I have two separate criteria queries (get the employee, then get the department).

Two questions:

    1. Is a theta-style (i.e. using =) outer join possible in HQL without the foreign key relationship?
    2. If so, can someone help me convert this to HQL?

Jason


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.