-->
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: org.hibernate.property.PropertyAccessor for custom lazy?
PostPosted: Mon Jun 15, 2009 10:07 am 
Regular
Regular

Joined: Tue Feb 17, 2009 5:13 am
Posts: 59
Hi all.

I have an A POJO with a b attribute which is a collection (Set) of B elements. Like this:
public class A {
Set<B> bs = new HashSet<B>();
// other fields and property access methods
}

The size of a.bs set could be some millions so I load it in a LAZY mode, of course.

I have annotated the bs field with DELETE_ORPHAN cascade so I can remove a b element from a.bs collection.
This is: a.bs.remove(b);

The problem is that this code iterate over whole collection looking for the B element, so every elements are loaded from DB. And, like there are millions of records,. this raises an Out Of Memory exception.

Is there any way to set custom access (with org.hibernate.property.PropertyAccessor, for example) to avoid the load of the elements, except just which I want to remove? the approach could be similar to LazyCollectionOption.EXTRA.

Summarizing: I need to look for over a lazy collection but not hitting the DB until find what I'm searching.

Any idea?

_________________
Born to lose... live to win!


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.