-->
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.  [ 4 posts ] 
Author Message
 Post subject: Lazy loading of associations when reverse engineerin
PostPosted: Tue Jun 20, 2006 3:36 pm 
Beginner
Beginner

Joined: Tue May 23, 2006 4:10 pm
Posts: 38
Location: Charleston, SC
How do you do it? We are using version 3.1 of hibernate tools and can't figure out how to generate mapping files with lazy loading enabled on associations.

Grant


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 20, 2006 5:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you do know that lazy is the default in Hibernate 3, right ? ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 20, 2006 6:04 pm 
Beginner
Beginner

Joined: Tue May 23, 2006 4:10 pm
Posts: 38
Location: Charleston, SC
That's our understanding. When we run a test that calls the get method on Session to return a POJO, the associations are returned. Apparently lazy loading is a common topic of discussion so maybe there's a misunderstanding on our part. I included the mapping file that's returning the associations. Maybe we are missing something.

Grant

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jun 20, 2006 2:48:02 PM by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
    <class name="gov.seahawk.portal.services.persistence.model.Vessel" table="Vessel" schema="dbo" catalog="SeaHawk_Repository">
        <id name="vesselId" type="string">
            <column name="vesselId" length="36" />
            <generator class="guid"></generator>
        </id>
        <many-to-one name="sourceIMONumber" class="gov.seahawk.portal.services.persistence.model.DataSource" fetch="select">
            <column name="sourceIMONumber" length="36" />
        </many-to-one>
        <many-to-one name="sourceFlag" class="gov.seahawk.portal.services.persistence.model.DataSource" fetch="select">
            <column name="sourceFlag" length="36" />
        </many-to-one>
        <many-to-one name="sourceUSCGNumber" class="gov.seahawk.portal.services.persistence.model.DataSource" fetch="select">
            <column name="sourceUSCGNumber" length="36" />
        </many-to-one>
        <many-to-one name="sourceName" class="gov.seahawk.portal.services.persistence.model.DataSource" fetch="select">
            <column name="sourceName" length="36" />
        </many-to-one>
        <many-to-one name="sourceVesselType" class="gov.seahawk.portal.services.persistence.model.DataSource" fetch="select">
            <column name="sourceVesselType" length="36" />
        </many-to-one>
        <many-to-one name="sourceAge" class="gov.seahawk.portal.services.persistence.model.DataSource" fetch="select">
            <column name="sourceAge" length="36" />
        </many-to-one>
        <many-to-one name="sourceRadioCallSign" class="gov.seahawk.portal.services.persistence.model.DataSource" fetch="select">
            <column name="sourceRadioCallSign" length="36" />
        </many-to-one>
        <property name="imoNumber" type="string">
            <column name="imoNumber" length="7" />
        </property>
        <property name="uscgNumber" type="string">
            <column name="uscgNumber" length="50" />
        </property>
        <property name="age" type="string">
            <column name="age" length="10" />
        </property>
        <property name="flag" type="string">
            <column name="flag" length="36" />
        </property>
        <property name="name" type="string">
            <column name="name" length="100" />
        </property>
        <property name="radioCallSign" type="string">
            <column name="radioCallSign" length="30" />
        </property>
        <property name="vesselType" type="string">
            <column name="vesselType" length="5" />
        </property>
        <property name="mdTimeStamp" type="timestamp">
            <column name="mdTimeStamp" length="23" />
        </property>
        <property name="mdLastUpdateId" type="string">
            <column name="mdLastUpdateId" length="20" />
        </property>
        <set name="vesselAgents" inverse="true">
            <key>
                <column name="vesselId" length="36" not-null="true" />
            </key>
            <one-to-many class="gov.seahawk.portal.services.persistence.model.VesselAgent" />
        </set>
        <set name="vesselOperators" inverse="true">
            <key>
                <column name="vesselId" length="36" not-null="true" />
            </key>
            <one-to-many class="gov.seahawk.portal.services.persistence.model.VesselOperator" />
        </set>
        <set name="vesselArrivals" inverse="true">
            <key>
                <column name="vesselId" length="36" not-null="true" />
            </key>
            <one-to-many class="gov.seahawk.portal.services.persistence.model.VesselArrival" />
        </set>
        <set name="vesselRisks" inverse="true">
            <key>
                <column name="vesselId" length="36" not-null="true" />
            </key>
            <one-to-many class="gov.seahawk.portal.services.persistence.model.VesselRisk" />
        </set>
    </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 20, 2006 6:30 pm 
Beginner
Beginner

Joined: Tue May 23, 2006 4:10 pm
Posts: 38
Location: Charleston, SC
I stand corrected. I ran our test through a debugger and the fields on the association class are null.

Grant


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.