-->
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: why does hibernat always use an outer join?
PostPosted: Wed Nov 03, 2004 11:41 am 
Newbie

Joined: Thu Aug 26, 2004 3:05 am
Posts: 4
Location: Austria, Linz
It seams to me that hibernate always uses an outer join when fetching a collection!
I have a 1:n relationship and I only want to select these records where records are present in the related table. But I get also the records where no entries are in the related table.
Where do I make a mistake?

Hibernate version: 2.1.6

Mapping documents:
...
<hibernate-mapping schema="handy" package="at.telekom.handy.dto" >

<class name="Delivery" table="delivery">

<id name="id" type="integer" unsaved-value="-1">
<column name="id" sql-type="number" not-null="true" />
<generator class="sequence">
<param name="sequence">Delivery_SEQ</param>
</generator>
</id>

<property name="delivered" column="delivered" />
<property name="deliveringdate" column="deliveringdate" />
<many-to-one name="address" class="Address" column="address_id" />

<set name="deliveryItems" lazy="true" outer-join="false">
<key>
<column name="delivery_id" />
</key>
<one-to-many class="DeliveryItem" />
</set>
<property name="deliverynoteNumber" column="deliverynotenumber" not-null="false"/>
</class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
...
Query q = session.createQuery("from at.telekom.handy.dto.Delivery d where d.delivered = false ");
return q.list();
...


Name and version of the database you are using:
oracle 8.1.xx

The generated SQL (show_sql=true):


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 03, 2004 12:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
use "join" in your query and please read the HQL documentation


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.