-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with lazy loading
PostPosted: Tue Feb 08, 2005 11:32 am 
Beginner
Beginner

Joined: Mon Dec 08, 2003 12:15 am
Posts: 47
Folks I apologize for the repost, but it seems that whenever you follow the rules and post to this forum as the moderators require, I hardly ever get any responses.

I am trying to lazily load a set and although all the queries run and all the objects are hydrated according to the log, I cannot see my objects inside the Set. What I have is a class Unit which has a Set and the set should contain the type Coverage. One to many. Lazy is set to false, and even though all the queries execute and it seems like the Coverage objects are being created, whenever I inspect the Set property in Unit, it doesn't have anything. I am 100% sure that there are records in the database for the particular Unit I am loading. I have never had this issue and it is driving me insane. All relevant files are below:

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="com.uaig.migration.history.as400.vo.Unit"
table="UQXXUNIT"
dynamic-update="false"
dynamic-insert="false"
>

<composite-id
name="unitPK"
class="com.uaig.migration.history.as400.vo.UnitPK"
>
<key-property
name="referenceNumber"
type="java.lang.Integer"
column="UUREFNO"
/>

<key-property
name="unitNumber"
type="java.lang.Integer"
column="UUNITNO"
/>
</composite-id>

<property
name="companyNumber"
type="java.lang.String"
column="UUCOMP#"
/>

<property
name="policyPrefix"
type="java.lang.String"
column="UUPRFXN"
/>

<property
name="policyNumber"
type="java.lang.Integer"
column="UUPLNBR"
/>

<property
name="unitType"
type="java.lang.String"
update="true"
insert="true"
column="UUNITTY"
length="2"
/>

<property
name="unitGroup"
type="java.lang.String"
update="true"
insert="true"
column="UUNITGR"
length="2"
/>

<property
name="vinId"
type="java.lang.String"
update="true"
insert="true"
column="UUVINID"
length="25"
/>

<property
name="unitYear"
type="java.lang.Integer"
update="true"
insert="true"
column="UUYEAR"
length="4"
/>

<property
name="unitMake"
type="java.lang.String"
update="true"
insert="true"
column="UUMAKE"
length="4"
/>

<property
name="unitModel"
type="java.lang.String"
update="true"
insert="true"
column="UUMODL"
length="10"
/>

<property
name="description"
type="java.lang.String"
update="true"
insert="true"
column="UUDESC"
length="30"
/>

<property
name="garageZipCode"
type="java.lang.String"
update="true"
insert="true"
column="UUZIPC"
length="9"
/>

<property
name="countyName"
type="java.lang.String"
update="true"
insert="true"
column="UUCNTY"
length="20"
/>

<property
name="cityName"
type="java.lang.String"
update="true"
insert="true"
column="UUCITY"
length="20"
/>

<property
name="countyCode"
type="java.lang.String"
update="true"
insert="true"
column="UUCNTCD"
length="5"
/>

<property
name="unitStatus"
type="java.lang.String"
update="true"
insert="true"
column="UUSTUS"
length="1"
/>

<property
name="unitActivity"
type="java.lang.String"
update="true"
insert="true"
column="UUACTY"
length="1"
/>

<property
name="mileToWork"
type="java.lang.Integer"
update="true"
insert="true"
column="UUMILE"
length="3"
/>

<property
name="deleteDate"
type="java.util.Date"
update="true"
insert="true"
column="UUDELDT"
length="7"
/>

<property
name="addDate"
type="java.util.Date"
update="true"
insert="true"
column="UUADDDT"
length="7"
/>

<property
name="ratedClass"
type="java.lang.String"
update="true"
insert="true"
column="UURCLS"
length="6"
/>

<property
name="odometerReading"
type="java.lang.Integer"
update="true"
insert="true"
column="UUODOM"
length="7"
/>

<property
name="ratedSymbol"
type="java.lang.String"
update="true"
insert="true"
column="UURSYMB"
length="2"
/>

<property
name="useCode"
type="java.lang.String"
update="true"
insert="true"
column="UUPUSEC"
length="2"
/>

<property
name="territory"
type="java.lang.String"
update="true"
insert="true"
column="UUTERR"
length="3"
/>

<property
name="passiveRest"
type="java.lang.String"
update="true"
insert="true"
column="UUPSRT"
length="2"
/>

<property
name="antiTheft"
type="java.lang.String"
update="true"
insert="true"
column="UUANTF"
length="2"
/>

<property
name="antiLock"
type="java.lang.String"
update="true"
insert="true"
column="UUANTLK"
length="2"
/>

<property
name="multiCar"
type="java.lang.String"
update="true"
insert="true"
column="UUMULTC"
length="1"
/>

<property
name="transferDiscount"
type="java.lang.String"
update="true"
insert="true"
column="UUTRNFD"
length="1"
/>

<property
name="ratedPDriver"
type="java.lang.Integer"
update="true"
insert="true"
column="UURTDRV"
length="3"
/>

<property
name="replacementCost"
type="java.lang.Integer"
update="true"
insert="true"
column="UURPLCT"
length="7"
/>

<property
name="customEquipment"
type="java.lang.String"
update="true"
insert="true"
column="UUCUSTE"
length="2"
/>

<property
name="highSymbolSurch"
type="java.lang.String"
update="true"
insert="true"
column="UUHGSYM"
length="2"
/>

<property
name="goodSafeDriver"
type="java.lang.String"
update="true"
insert="true"
column="UUSNRDR"
length="1"
/>

<property
name="unitChange"
type="java.lang.String"
update="true"
insert="true"
column="UUNITCH"
length="1"
/>

<property
name="vinChange"
type="java.lang.String"
update="true"
insert="true"
column="UUVINCH"
length="1"
/>


<set
name="unitCoverages"
lazy="false"
inverse="true"
cascade="all-delete-orphan"
>
<key>
<column name="UCREFNO" />
<column name="UCNITNO" />
</key>

<one-to-many
class="com.uaig.migration.history.as400.vo.Coverage"
/>
</set>

</class>
</hibernate-mapping>

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="com.uaig.migration.history.as400.vo.Coverage"
table="UQXXCOVG"
dynamic-update="false"
dynamic-insert="false"
>
<composite-id
name="coveragePK"
class="com.uaig.migration.history.as400.vo.CoveragePK"
>
<key-property
name="referenceNumber"
type="java.lang.Integer"
column="UCREFNO"
/>

<key-property
name="unitNumber"
type="java.lang.Integer"
column="UCNITNO"
/>

<key-property
name="coverageCode"
type="java.lang.String"
column="UCOVGCD"
/>
</composite-id>

<property
name="companyNumber"
type="java.lang.String"
column="UCCOMP#"
length="2"
/>

<property
name="policyPrefix"
type="java.lang.String"
column="UCPRFXN"
length="4"
/>

<property
name="policyNumber"
type="java.lang.Integer"
column="UCPLNBR"
length="9"
/>

<property
name="coverageDescription"
type="java.lang.String"
update="true"
insert="true"
column="UCOVGDS"
length="40"
/>

<property
name="coverageLimit"
type="java.lang.String"
update="true"
insert="true"
column="UCOVGLM"
length="13"
/>

<property
name="coverageDeductible"
type="java.lang.Integer"
update="true"
insert="true"
column="UCOVGDU"
length="9"
/>

<property
name="coverageDeductibleType"
type="java.lang.String"
update="true"
insert="true"
column="UCOVGDT"
length="1"
/>

<property
name="coverageStatus"
type="java.lang.String"
update="true"
insert="true"
column="UCOVGST"
length="1"
/>

<property
name="coverageAddDate"
type="java.util.Date"
update="true"
insert="true"
column="UCOVGAD"
length="7"
/>

<property
name="coverageDeleteDate"
type="java.util.Date"
update="true"
insert="true"
column="UCOVGDD"
length="7"
/>

<property
name="coverageInfPrm"
type="java.math.BigDecimal"
update="true"
insert="true"
column="UCOVGIP"
length="11"
/>

<property
name="coverageWrittenPremium"
type="java.math.BigDecimal"
update="true"
insert="true"
column="UCWRTPM"
length="11"
/>

<property
name="coverageValue"
type="java.lang.Long"
update="true"
insert="true"
column="UCOVGVL"
length="11"
/>

<property
name="coverageChange"
type="java.lang.String"
update="true"
insert="true"
column="UCOVGCH"
length="1"
/>
</class>

</hibernate-mapping>


UnitPK pk = new UnitPK();
pk.setReferenceNumber(new Integer(600100));
pk.setUnitNumber(new Integer(1));
Unit un = (Unit) as400Session.load(Unit.class,pk);

The unitCoverages Set in Unit does not have anything in it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 11:42 am 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
*sigh*, see your 'other' thread for my reply. PITA with the double posting.

For the record, I don't see where this has anything to do with lazy loading either since lazy="false".


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 11:56 am 
Beginner
Beginner

Joined: Mon Dec 08, 2003 12:15 am
Posts: 47
You're right, instead of lazy I should have called it eager.


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