Comments (2)
To resolve the casting exception, EntityReadWriteAccess needs to be overridden by handling Casting Exception
package org.hibernate.cache.spi.support;
public class EntityReadWriteAccess extends AbstractReadWriteAccess implements EntityDataAccess
@Override
public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version) {
try {
writeLock().lock();
* Lockable item = (Lockable) getStorageAccess().getFromCache( key, session ); // <--- casting exception point #1
if ( item == null ) {
getStorageAccess().putIntoCache(
key,
new Item( value, version, getRegion().getRegionFactory().nextTimestamp() ),
session
);
return true;
}
else {
return false;
}
}
finally {
writeLock().unlock();
}
}
@Override
public boolean afterUpdate(
SharedSessionContractImplementor session,
Object key,
Object value,
Object currentVersion,
Object previousVersion,
SoftLock lock) {
try {
writeLock().lock();
* Lockable item = (Lockable) getStorageAccess().getFromCache( key, session ); // <--- casting exception point #2
if ( item != null && item.isUnlockable( lock ) ) {
SoftLockImpl lockItem = (SoftLockImpl) item;
if ( lockItem.wasLockedConcurrently() ) {
decrementLock( session, key, lockItem );
return false;
}
else {
getStorageAccess().putIntoCache(
key,
new Item( value, currentVersion, getRegion().getRegionFactory().nextTimestamp() ),
session
);
return true;
}
}
else {
handleLockExpiry(session, key, item );
return false;
}
}
finally {
writeLock().unlock();
}
}
from hibernate-arcus.
This is not a bug, but is intended by hibernate-orm
Solution:
When changing CacheConcurrencyStrategy, regionName should be modified together not to reuse same cache items
from hibernate-arcus.
Related Issues (7)
- TTL of cache item needs to be configurable. HOT 1
- Cache item(entity) is stored in json format of plain text
- TTL of Lock should be set with timeout field of itself HOT 1
- Maven central release is in process with 1.0.0-RELEASE HOT 2
- DomainDataStorageAccess needs fallback in case of connection failure or cache command failure HOT 2
- CacheEvict on CachePut is optional property and multiple cache region entities are evicted together. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hibernate-arcus.