-->
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: join fetch not working
PostPosted: Wed Dec 05, 2007 12:04 pm 
Newbie

Joined: Tue Aug 02, 2005 3:21 pm
Posts: 14
Hibernate version: 1.2.0

I have a class, EfpSecurityNHib, that has a member reference, DerivDetail. When I load EfpSecurityNHib with fetch="join", I do get a select with outer join, but then NHibernate does another select on the DerivDetail class!

Here's the map file contents:
===============================================================
Code:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">

    <class name="EfpSecurityNHib, DASDataSourceSecurityPrd" table="hts_sec_master" lazy="false">
   
        <id name="sm_id" column="sm_id">
            <generator class="Efp.Das.DataSource.Orm.NHibernate.GetNextRowIdGenerator, DASDataSource">
                <param name="table">hts_sec_master</param>
            </generator>
        </id>
       
        <property name="sm_sec_type" insert="false" update="false"/>
       
        <many-to-one name="DerivDetail" column="sm_id" property-ref="deriv_sm_id"
            unique="true" insert="false" update="false" cascade="all"
            lazy="false" fetch="join"/>
           
    </class>
</hibernate-mapping>

===============================================================
Notes:
- DerivDetail is a property of EfpSecurityNHib
- sm_id is the id column of hts_sec_master, which is mapped to EfpSecurityNHib
- deriv_sm_id is a simple property the class of DerivDetail
- The class of DerivDetail is mapped to table hts_sm_deriv_detail.

The following code results in a left outer join select *and* a separate select of hts_sm_deriv_detail.
===============================================================
Code:
EfpSecurityNHib sec = (EfpSecurityNHib)session.Load(typeof(EfpSecurityNHib), 3979190);

===============================================================

Why am I getting the extra select?!?

Thanks in advance for any help!
Code:
Code:
Code:
Code:


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.