-->
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: Reason why collection cache is populated after _loading_?
PostPosted: Fri Mar 28, 2008 7:01 pm 
Newbie

Joined: Wed Aug 27, 2003 7:31 am
Posts: 9
Location: Russia, Izhevsk
I'm writing an extension to Hibernate - a super-extra-lazy multimap. It will solve the following common problem:

Suppose you have a user and his emails. The naive solution:

public class User
{
public Set<Mail> mails;
...
}

will be excruciatingly slow on most operations. Besides, it will be 2nd-level-cache-unfriendly.

I'm going to add a new type "BigMultiMap" (I call them "bigmaps") which will allow to do something like this:

public class User
{
public BigMultiMap<Date, Mail> mails;
}

It will allow lazy loading by key ranges - i.e. it will lazily load ranges of keys and values from database by request.

I have studied the internals of Hibernate and so far it looks that my idea is possible.

I also want to support caching of _half-loaded_ bigmaps (there's no sense in storing COMPLETE bigmaps, but it makes a very good sense to store the accessed parts of it). However, Hibernate caches collections after they are _completely_ _initialized_ which never happens with the extra-lazy collections!

What is the reason for this behavior? IMO, it's much more logical to store collections during the flush.

Is it possible to add collection to the cache in the "PersistentCollection.postAction()" callback? I guess there might be issues with read-write caches and locking, but so far I only care about transactional caches.

PS: why am I disallowed posting in dev list?

_________________
Sapienti sat!


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.