-->
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: Limit on depth of foreign key object loading
PostPosted: Mon Jul 18, 2005 5:07 pm 
Newbie

Joined: Tue Feb 10, 2004 9:26 am
Posts: 12
Hello.

I am using the following versions:

Hibernate version:2.1.8
Name and version of the database you are using:Postgresql 7.4.7

When I run a query using:
Code:
Query q = session.createQuery(getQueryText(queryLines));
parseQueryArgs(q, passedArgs);
ObjectList result = new HibObjectListImpl(q.list());


I get the correct results though the foreign keys only go four deep through
many-to-one mappings?

It's probably a bad habit but I have a few occasions where there was the following type of scenario:

Code:
SELECT * FROM dept WHERE deptId = 1;

I run this through the query DAO above.

then in the code I do the following.
Code:
dept.getFran().getOrg.getGroup.getName();

but this returns null, not the value 'groupName' from the database.

If I run dept.toString() I get:

Code:
[deptId=1, name=deptName, fran=[franId=2, name=franName, org=[orgId=2, name=orgName, group=[groupId=2,  name=null, groupTp=null, groupTpId=0, status=null, statusId=0, startTimestamp=null, lastModified=null], groupId=2], orgId=2], franId=2]]


You can see the foreign keys for the group object a have not been loaded.

I know this is really bad and I like the fact that hibernate only fetches deep into foreign keys but I was wondering if there is a way to toggle this setting and if not why isn't it better documented. I may be searching for the wrong thing but I haven't been able to find any documentation on the number of foreign keys deep hibernate loads for queries.
Is there a way around this ?
Is this behavior well documented ? (I would like to check it before upgrading)

Should I upgrade to hibernate 3.x ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 5:19 pm 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
It is in the documentation.

http://www.hibernate.org/hib_docs/v3/re ... n-optional

Look for the property: hibernate.max_fetch_depth


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.