Folks,
Is it true that HQL would ignore the outer join (i.e. outer-join) mapping setting and criteria would not?
If yes, any work around so that I could use implicit joins (i.e. via dot notation only) with outer join without putting the join (i.e. left join) into HQL manually myself? (As currently, the searching parameter(s) are passed in to me with dot notation, I build the HQL based on the passed in parameter(s), I'm hoping I could keep appending the where clause of HQL without touching the from clause! I could not use the criteria inteface due to some current limitation of criteria interface.
e.g. expected HQL (with outer join)
select vo.objId, vo.currency.objId, vo.currency.code from CompanyVO vo where vo.code = '1'
instead of
select vo.objId, vo.currency.objId, vo.currency.code from CompanyVO vo
left join vo.currency where vo.code = '1'
Thanks in advance!
Martin
Hibernate version:
2.1.6
Mapping documents:
Code:
<class name="CompanyVO"
table="COMPANY"
lazy="false"
optimistic-lock="version"
dynamic-update="true"
>
...
<many-to-one name="currency"
column="CURRENCY_GNLUOBJID"
class="CurrencyVO"
outer-join="true"
cascade="all"
/>
</class>
Name and version of the database you are using:Oracle 8.1.7
The generated SQL (show_sql=true):<!--
Use HQL: select vo.objId, vo.currency.objId, vo.currency.code from CompanyVO vo where vo.code = '1'
-->
Code:
SELECT
companyvo0_.OBJID AS x0_0_,
companyvo0_.CURRENCY_GNLUOBJID AS x1_0_,
currencyvo1_.CODE AS x2_0_
FROM
COMPANY companyvo0_,
GENERICLOOKUP currencyvo1_
WHERE
companyvo0_.CURRENCY_GNLUOBJID=currencyvo1_.OBJID AND
((companyvo0_.CODE='1' ))
<!--
Criteria interface
-->
similar sql with outer join (i.e. "(+)") appended to the join.