-->
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: How to avoid preloading large data sets when adding
PostPosted: Fri Mar 09, 2007 2:48 am 
Newbie

Joined: Fri Mar 09, 2007 2:01 am
Posts: 5
I have an unusual problem that I can't seem to figure out how to deal with. Basically I have a many to many mapping from categories to news articles (ie, one news article can be listed under many categories, and a category can have many news articles).

Now everything functions just fine, until I try and add a news article to a category that contains 90k+ news articles. Hibernate decides to fetch all 90k news articles when I call category.getDocuments().add(d) which is a huge resource hog and I run into a problem of running out of memory. While I would prefer to use a set mapping, I've tried many different mappings and after reading through the documentation a bunch and have settled on using an idbag with a hilo id generator for the collection id column. I would think that since the idbag has no duplicate matching and with the lazy=true/extra option set, it wouldn't need to preload the document list.

Am I missing something? Would inverse mappings help? Or would I run into the same problem with loading when I called category.getDocuments().add(d). Is there a way to trick hibernate into using SQL queries to figure out collisions with sets? or stop hibernate from loading idbags for adding?

Any help would be appreciated.


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.