-->
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.  [ 1 post ] 
Author Message
 Post subject: Collection initialised with proxies?
PostPosted: Tue Jan 24, 2006 11:33 pm 
Newbie

Joined: Tue Jan 24, 2006 10:02 pm
Posts: 12
Hi (N)Hibernate Community,

As noted in the documentation, most relations (associations) in a DB schema are 1 to n.
That implies that every parent entity will get a collection of its children, if it is mapped into the OO world.
My first thought was that this would lead to a big object graph, mapping nearly the complete DB, if the the loaded object was the top-level object in the schema.
Fortunately, I discovered lazy loading and was happy. But when I played with a simple Parent/Child bidirectional association, I figured out that if I touch the collection of children in the parent object, all children are completely loaded.
I hoped defining the child object as proxy would change that behaviour, but it did not.

Well! Is it correct to define a proxy as lazy loading of a single object and a collection wrapper as lazy loading of a collection?
But it is not possible to have a collection of proxies where an access to a proxy leads to a DB fetch, which would mean, iterating a collection of n proxies would lead to n selects without batching?
And that functionality I wish to have is implemeted in H 3.1 (lazy="extra")?

That means one should touch the collection only if all objects are needed, otherwise it is better to use HQL.
But what are collections good for, if I cannot delete a child from the parent without loading, for instance, all the other 100000 children?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.