The following TOAD query works with the ansi outer joins but I'm having trouble implementing it in Hibernate 3 HQL. Can you provide any suggestions ?
select tc.*
, sd.*
from table_tc tc
left outer join table_td td on td.table_td_ky = tc.table_td_ky
left outer join table_tc loadtc
on loadtc.table_td_Ky = td.table_td_ky
and loadtc.catg_cd = 'ORIG '
and loadtc.clsf_cd = 'XXX '
and loadtc.task_cd = 'LOAD '
left outer join table_sd sd
on sd.whse_Ky = loadtc.TRAN_ky
and sd.whse_typ_cd = 'TCTL '
where tc.table_td_ky = td.table_td_ky
and tc.task_cd = 'RLSE '
and tc.cvt_stat_cd = 'C2SPN'
and tc.status_cd = 'RLPND'
The following HQL works as though using joins not outer joins:
<query name="tctl.tec">
<![CDATA[
select tc, loadsd
from tc tc left outer join tc.td
, tc loadtc
, sd sd
where tc.statusCd = ?
and tc.cvtStatCd = ?
and tc.taskCd = ?
and loadtc.td.tdKy = tc.td.tdKy
and loadtc.categoryCd = 'ORIG '
and loadtc.classificationCd = 'XXX '
and loadtc.taskCd = 'LOAD '
and sd.whseKy = loadtc.tranKy
and sd.whseTypCd = 'TCTL '
order by tc.stdId, tc.verId, tc.docId
]]>
</query>
|