-->
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: outer-join mapping question for HQL (not Criteria)
PostPosted: Wed Sep 15, 2004 6:19 pm 
Beginner
Beginner

Joined: Tue Mar 23, 2004 8:40 pm
Posts: 22
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 2:51 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
Is it true that HQL would ignore the outer join (i.e. outer-join) mapping setting and criteria would not?

right

Quote:
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?

right

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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.