[hibernate-dev] Question regarding method ReadWriteEhcacheNaturalIdRegionAccessStrategy#afterInsert
Demetz, Guenther
Guenther.Demetz at wuerth-phoenix.com
Wed Jun 13 06:08:43 EDT 2012
Hi Alex,
I have a question in regard to class ReadWriteEhcacheNaturalIdRegionAccessStrategy where you are listed as co-author.
Do you maybe know, why inserts do only succeed if there is no existing value mapped to the actual key?
Code-snippet of ReadWriteEhcacheNaturalIdRegionAccessStrategy#afterInsert
<< if ( item == null ) {
<< region.put( key, new Item( value, null, region.nextTimestamp() ) );
Namely I did expect, that in case of item being an "unlocked" Lock, the insert should succeed nonetheless.
Something like following:
>> if ( item == null || item.isWriteable( region.nextTimestamp(), null, null ) ) {
>> region.put( key, new Item( value, null, region.nextTimestamp() ) );
I ask because after trying to resolve a Todo in StatefulPersistenceContext (you find it by searching for "should be using access strategy, not plain evict.. "),
some test in CachedMutableNaturalIdStrictReadWriteTest fails exactly because such "re-caching" attempts do not succeed anymore.
best regards
Guenther Demetz
More information about the hibernate-dev
mailing list