-->
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 and one-to-one
PostPosted: Tue Oct 14, 2003 11:41 am 
Newbie

Joined: Tue Oct 14, 2003 11:32 am
Posts: 9
Location: Switzerland
Hi,
I'm using Hibernate 2.0.3 with Firebird and (of course) the Interbase dialect.

I have a one-to-one relashionship between two classes, Listing and Instrument. hibernate.use_outer_join is set to true (and I can see it in the log output) but when loading listings outer join is not used, resulting in a query for loading listings and subsequent x queries for loading the associated instruments.

Thank you for any help :)
Massimo

// code snippet
List listings = session.find("from Listing listing");

This is an extract of the mapping

<class name="Listing" table="listing">
<id name="id" type="integer">
<generator class="assigned"/>
</id>
<timestamp name="lastModified"/>

...

<one-to-one name="instrument" cascade="all" class="Instrument"/>
</class>

<class name="Instrument" table="instrument">
<id name="id" type="integer">
<generator class="assigned"/>
</id>

...

</class>


Top
 Profile  
 
 Post subject: use fetch
PostPosted: Wed Oct 15, 2003 3:10 am 
Newbie

Joined: Tue Oct 14, 2003 11:32 am
Posts: 9
Location: Switzerland
For completeness I answer to myself :)
I achieved what I needed (associacion of instruments initialized with listings) using the fetch keyword and a left join:

select listing from Listing as listings
left join fetch listing.insturment as instrument

Regards
Massimo


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.