-->
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.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Object graph question
PostPosted: Thu Nov 06, 2003 4:42 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Hi,

First of all: THANKS A LOT FOR A FANTASTIC PRODUCT.

Now, my questions:

I have a rather large object graph which I have mapped successfully.

My question is: without setting lazy, will loading a root object load the entire graph? Or does it just fetch the first-level relations and then lazy-load the rest?

The object graph closure includes about 40 other classes (directly or indirectly) Will it try to join the entire thing?

What if my graph contains circular references?

Please tell me how Hibernate works without lazy.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 06, 2003 3:02 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
many-to-ones are always loaded right away unless you use a lazy proxy.

one-to-many and many-to-many are loaded right away unless lazy=true.

so if you have lazy="false" on everything you will load the entire object graph as far as it can navigate from where you load.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 06, 2003 9:32 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
OK, thanks. Is there a problem with having lazy="true" on all relations? I'm looking for the best defaults... (I generate the mapping file)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 4:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Davs Nick,

On the systems I've used hibernate with auto-generated mapping files I setted all to lazy, lazy, lazy + proxy ;)

Mainly because I had several access paths and query strategies for the data and thus I could not find a good way of defining what should be autoloaded or not....but that said, I would also consider going in a mark some of the stuff non-lazy simply because there aaalways is some stuff that needed to be loaded together - but that is dependent on the system and on your persistence/query strategies.

Mvh

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 4:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Always lazy is what I would do.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 5:30 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Thanks for useful responses.

However, I'm still curious about how Hibernate deals with circular references. Is that different in the lazy and non-lazy cases?

Thanks again!!!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 6:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
How about you let me worry about circular references. Thats the point.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 8:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
That weren't nice answer Gavin ;)

nick - if you really want to now then look for the source ;)

(but I can tell you that to resolve such stuff it utilizes the session cache and some standard magick to do it - look for any decent ORM articles about this ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 9:04 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Gavin: I respect what you have done with Hibernate and that you have a lot of work to do, but don't be disrespectful. I actually find no answer to be way better than answers that makes me feel even more stupid than I am...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 9:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yeah well, I know - I was feeling a bit frustrated this afternoon. I'm just not sure what a "nice" answer to "how does Hibernate handle circular references?" looks like.

You want me to completely explain the session level cache, two-phase load, disassembly/reassembly to and from the second-level cache, etc, etc? If you want to know, look at the code. The user shouldn't need to care, however.

sorry for being rude this time, all previous times, and all future times.....


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 10:18 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
gavin wrote:
sorry for being rude this time, all previous times, and all future times.....

Hum, can be in the faq ;-)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 10:35 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
"You want me to completely explain the session level cache, two-phase load, disassembly/reassembly to and from the second-level cache, etc, etc? "

Hell no... saying "hibernate handles it for you" would suffice. I don't really care about the implementation - just tried to ask if I had to think about it when doing mapping, using the API, etc. Maybe my wording was wrong... hum, yes, obvisouly so.

"sorry for being rude this time, all previous times, and all future times....."

Sarcasm.... Fine.

I'm warning you about this grumpiness because I know of people who don't use JBoss because of Marc Fleury's way of handling people (on forums, mail lists and otherwise) It is easy to get put off.

So be careful.

/Nick


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 10:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually it was not sarcasm.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 11:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
And before you start with criticism of myself, Marc, or any one else, you should try to understand exactly how hard it is to handle the volume of user questions on this list, particularly when some people don't take the time to phrase questions properly (eg. asking "how does Hibernate handle circular references?" when all they really want to know is "Does Hibernate handle circular references?") or give enough information for me to be able to help. Yes, the forum actually comes with explicit instructions about what information to provide when you have a problem, but an enormous amount of the noise here consists of requests by those of us who answer questions for exactly that information. Guys it really doesnt take that much extra effort on your part to ask questions well - and it saves a lot of time for us.

Before I went fulltime on this, the forum traffic was absolutely killing me. You actually can't imagine how impossible it was to keep up. Now that its actually a paying job, I try to resolve to be much more patient and not get frustrated as often. Saying nothing is better than being rude. But, surprise, surprise, I am actually an imperfect human.

Now, I am grateful that too much success is our problem and certainly we can and do always continue to improve many things.

For example, Christian went to a lot of effort to give us a great new fully searchable forum, and I really hope that people will make use of this. I think the signal-to-noise has improved since we switched, so obviously some people are.

And finally, Nick, don't take this the wrong way, but no software vendor on earth, commercial or opensource would not have got a bit frustrated with you after your 95-questions-in-two-and-a-half-weeks marathon run, many of which were definitely stretching the limits of politeness in their own right.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 4:47 pm 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Quote:
And before you start with criticism of myself, Marc, or any one else, you should try to understand exactly how hard it is to handle the volume of user questions on this list


I know its hard, but that's no excuse for responding like a 9 year old when he face a problem.

I've been one many heavy traffic lists and forums where the core members behave as they would if they met posters face to face. The Subversion and GLUE projects are excellent examples.

More often than not, however, forums and lists are driven by elitism and grumpiness. I hate that.

Still love your work, though :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next

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.