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.  [ 5 posts ] 
Author Message
 Post subject: Fetch Depth
PostPosted: Tue Mar 08, 2005 5:42 am 
Beginner
Beginner

Joined: Tue Nov 09, 2004 6:26 am
Posts: 32
[b]Mapping documents:[/b]

<class name="Person" table="PERSON">
...
<set name="subjectAddress" lazy="true">
<key column="SUBJECT_ID"/>
<one-to-many
class="SubjectAddress"/>
</set>
</class>

<class name="SubjectAddress"
table="SUBJECT_ADDRESS">

...
<many-to-one name="emailAddress"
class="EmailAddress"
column="ADDRESS_ID"
outer-join="true" insert="false" update="false"
cascade="none"/>
</class>

Whe I get one Person
select pers from Person where pers.subjectId=:sid
I get an:
No row with the given identifier exists: 2528, of class: EmailAddress
because that person doesn't have an email address.

What am I doing wrong in preventing Hibernate loding the entire object graph?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 6:11 am 
Beginner
Beginner

Joined: Tue Nov 09, 2004 6:26 am
Posts: 32
I've set hibernate.max_fetch_depth but I did not obtained the desired result.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 8:50 am 
Beginner
Beginner

Joined: Tue Nov 09, 2004 6:26 am
Posts: 32
Please, at least give me a hint.
I'm sure you don't give an answer to many (usualy stupid) questions just to avoid encouraging lack of sduty and superficiality from the developer side.

I can assure you I've read the book. It's possible to have overlooked something. Now I'm too tierd and don't have enough time to start all over again. Please help me.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 10:10 am 
Beginner
Beginner

Joined: Tue Nov 09, 2004 6:26 am
Posts: 32
I've remembered something. Lazy fetching for assocations cand be done using lazy="true" for a class or the proxy attribute.
I also removed the outer-joined attributes from my relation mapping to avoid overridng the fatching strategy.

What else should I pay attention to?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 12:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use a <one-to-one><formula></one-to-one> mapping instead of a <many-to-one> in HB3.


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