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?
|
|