-->
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.  [ 8 posts ] 
Author Message
 Post subject: Lazy Map that loads just the keys
PostPosted: Wed Jun 09, 2004 1:43 pm 
Newbie

Joined: Fri Apr 16, 2004 11:48 am
Posts: 18
Hi,

Is it possible to have a lazy map that loads only the keys and leave the objects to null?

Many thanks!!!


Top
 Profile  
 
 Post subject: Re: Lazy Map that loads just the keys
PostPosted: Mon Jun 14, 2004 7:47 pm 
Regular
Regular

Joined: Sat Feb 21, 2004 8:54 pm
Posts: 60
Location: Lakewood, California
milasx wrote:
... Is it possible to have a lazy map that loads only the keys and leave the objects to null? ...


i have this legcy db that has sets that have thousands of elements. i would love one of these for my one to many relations?

has anyone done this or made a proxy that does this?

thanks

_________________
<http://tayek.com/>, co-chair <http://www.ocjug.org/>, actively
seeking telecommuting work. hate spam?
<https://www1.ietf.org/mailman/listinfo/asrg>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2004 7:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is the defaut behavior for a many-to-many association to a proxyable class.


(It makes no sense for a one-to-many association.)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2004 8:30 pm 
Regular
Regular

Joined: Sat Feb 21, 2004 8:54 pm
Posts: 60
Location: Lakewood, California
gavin wrote:
...(It makes no sense for a one-to-many association.)


i am a newbie and am trying to take your advice about a helper method in the parent class that always points the child to the parent and adds the child to the parent's set.

since some of my set's have thousands of elements and the elements can be a thousand bytes or so. and i am a bit worried about getting out of sync with the db. so it would seem to make some sense (to the dummy here) to have a proxy that would just load the keys and allow some limited access to the set to reduce the memory footprint.

i suspect that it may involve writing my own proxy?

can you elighten me as to why this is not reasonable or doable?

thanks

_________________
<http://tayek.com/>, co-chair <http://www.ocjug.org/>, actively
seeking telecommuting work. hate spam?
<https://www1.ietf.org/mailman/listinfo/asrg>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2004 8:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Two different solutions, which are not vulnerable to n+1 selects

(1) map 2 collections to the same table
(3) use a collection filter with projection


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2004 8:39 pm 
Regular
Regular

Joined: Sat Feb 21, 2004 8:54 pm
Posts: 60
Location: Lakewood, California
gavin wrote:
Two different solutions, which are not vulnerable to n+1 selects

(1) map 2 collections to the same table
(3) use a collection filter with projection


thanks, i will research those.

_________________
<http://tayek.com/>, co-chair <http://www.ocjug.org/>, actively
seeking telecommuting work. hate spam?
<https://www1.ietf.org/mailman/listinfo/asrg>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2004 10:55 am 
Newbie

Joined: Fri Apr 16, 2004 11:48 am
Posts: 18
Quote:
(It makes no sense for a one-to-many association.)


Why would it not make sense? Could you please elaborate on it?

Many thanks!!!

Simone


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 12:06 pm 
Regular
Regular

Joined: Sat Feb 21, 2004 8:54 pm
Posts: 60
Location: Lakewood, California
milasx wrote:
Quote:
(It makes no sense for a one-to-many association.)

Why would it not make sense? Could you please elaborate on it?
Simone

i am the newbie, so i don't really have a clue as to why it might be silly in most cases and i have not done the research yet. but in any case gavin said:

"...
(1) map 2 collections to the same table
(3) use a collection filter with projection
..."

my take on the first one is that one of the collections is the normal set of objects and is bi-directional. while the other might be some kind of one-way one to many that just went to the pk (somehow of the child table). maybe there is a way to tell hibernate to just use the value (fk) in the object and never chase down the reference). and is you never forces the load of the heavy duty set, then maybe you could just point the child to the parent and add the childs id to the parent's second set (i am guessing).

or maybe just jave another table that has the id's of the first (and nothing else) and load that set up up and use it? (isn't this an an index or something in some old dbms's?).

my take on the other is that there is a way to filter the collection and just get the keys with a projection. and that hibernate is smart enought to have the database do the filtering and projection. so all you would get would be the keys (or whatever subset of the data in the records that you were interested in).

also, iirc, that a previous post said something to the effect that just getting the keys (or pairs of keys) was a way that they did this with many to many (or maps or both or something). so there wil be some way to do this. i jut haven't quite figured out how.

but i can delay doing this for a while as i am just doing testing and working on small samples.

thanks

_________________
<http://tayek.com/>, co-chair <http://www.ocjug.org/>, actively
seeking telecommuting work. hate spam?
<https://www1.ietf.org/mailman/listinfo/asrg>


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