-->
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: One to One relation generates outer join
PostPosted: Thu May 14, 2009 11:39 am 
Newbie

Joined: Fri Mar 13, 2009 10:36 am
Posts: 10
Hi All,

I have the following mapping in hibernate. When I do a Session.load for Subscriber object. It always return the following

SELECT subscriber0_.SubGuid as SubGuid30_2_, subscriber0_.FirstName as FirstName30_2_, subscriber0_.Version as Version30_2_, account1_.SubscriberId as Subscrib1_31_0_, account1_.Amount as Amount31_0_, address2_.SubGuid as SubGuid32_1_, address2_.FirstLine as FirstLine32_1_, address2_.Version as Version32_1_ FROM dbo.Subscriptions subscriber0_ left outer join dbo.Accounts account1_ on subscriber0_.SubGuid=account1_.SubscriberId left outer join dbo.Addresses address2_ on subscriber0_.SubGuid=address2_.SubGuid WHERE subscriber0_.SubGuid='2c2c9c82-526e-4a7c-baec-5a1744f32a43'

The relationship between Subscriber and account is one to one and also Subscriber and address is one to one
How do I get hibernate to return to return a inner join instead of a outer join ?

Code:
  <class name="A.B.Subscriber, Code" lazy="false" table="Subscriptions">
    <id name="SubscriberId" column="SubGuid">
      <generator class="assigned" />
    </id>
    <property name="FirstName" />
    <property name="Version" />
    <one-to-one name="Account" cascade="all" />
    <one-to-one name="Address" cascade="all" />
  </class>

  <class name="A.B.Account, Code" lazy="false" table="Accounts">
    <id name="SubscriberId" column="SubscriberId">
      <generator class="foreign">
        <param name="property">SubscriberInternal</param>
      </generator>
    </id>
    <property name="Amount" />
    <one-to-one name="SubscriberInternal" constrained="true" />
  </class>

  <class name="A.B.Address, Code" lazy="false" table="Addresses">
    <id name="SubscriberId" column="SubGuid">
      <generator class="assigned" />
    </id>
    <property name="FirstLine" />
    <property name="Version" />
  </class>


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.