-->
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.  [ 4 posts ] 
Author Message
 Post subject: lazy collection question
PostPosted: Sun May 14, 2006 7:52 pm 
Newbie

Joined: Thu Mar 30, 2006 8:23 am
Posts: 6
Hello all,

I need some advice on how to map a parent/child relation where the children are stored in a collection(list) in the parent. The children are a very large number so loading them all is quite undesirable and totally unnecessary. Here is a basic definition of the participants:
Code:
class Parent
{
IList children = new ArrayList(); // the list of children of type Child
}

class Child
{
string name;
}


I tried making the collection of children "lazy" but as soon as I try to access the 100-th child (they are much much more), the whole collection is fetched into memory and all the children are instantiated.

Any ideas are welcome!

Best regards,

Petar


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 15, 2006 3:26 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
One option is to do without the collection and use HQL or criteria queries instead to only fetch what is needed.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 5:39 pm 
Newbie

Joined: Thu Mar 30, 2006 8:23 am
Posts: 6
Hello Sergey,

Sorry, I somehow did not get an e-mail about your post!

Quote:
One option is to do without the collection and use HQL or criteria queries instead to only fetch what is needed.


I was wondering is there any technical hinderance in providing the feature I am seeking ? I looked at the IList implementation for a list collection and at any attempt to access anything in the collection, the whole collection was being fetched without any attempt to be smart about it. And I am pretty sure you guys are a smart bunch :)
May be you just have too many things to do ...

Best regards,

Petar


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 5:15 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
It is implemented in Hibernate 3, so eventually it will get ported over, but right now there are other things to do.


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