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: How deep does NHibernate nest references?
PostPosted: Tue Nov 08, 2005 11:55 am 
Newbie

Joined: Fri Nov 04, 2005 2:45 pm
Posts: 18
Location: Gainesville, FL
Yet another question.

I'm building a test app based on the Northwind DB. The employee table has a column, ReportsTo, which is the ID for another row in the same table. I have translated this into a <many-to-one> relationship in my mapping file.

All the rows in the Employees table has an id in the ReportsTo DB. Therefore, each mapped entity created by NHibernate could potentially point to another employee, one level deeper in the hierarchy.

One other potential situation is the case where two employees report to each other, creating a circular reference.

My question is this: now deep does NHibernate parse the nested references? How does NHibernate deal with circular references of this type?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 09, 2005 10:57 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
If Employee is lazy, then ReportTo will be load at its first access.
Else, all ReportTo will be loaded (each with its query) until they are all in memory.

AFAIK, in both case, it should work recursivily with no problem; note that the session will not load an instance that is already in its cache, so there is no problem with the circular reference.

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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.