-->
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: OSCache and redefined Composite primary key's toString()
PostPosted: Fri Jun 25, 2004 11:45 am 
Newbie

Joined: Fri Jun 25, 2004 11:21 am
Posts: 1
I had a big problem with 2nd level cache when using OSCache.

Since OSCache uses String!! as key instead of Object it is a problem when a persistent class has got Composite primary key (with well redefined equals() and hashCode() methods) and you redefine toString() method. OSCashe provider stores the instance into cache using not compositePk itself but using the String coming from compositePk.toString() - see source code.

If you redefine toString() of your primary key class to not produce unique String (unfortunately I did exactly that for logging and debugging reasons) the cache returns invalid objects.

I would appreciate this limitation to be mentioned in Hibernate doc. OSCache performs very well, but I was very dissapointed after realizing that OSCache is based upon Strings.

Is there anything anywhere more about this?


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.