public class EntityReadWriteAccess extends AbstractReadWriteAccess implements EntityDataAccess
EntityDataAccess
using the AccessType.READ_WRITE
access type.AbstractReadWriteAccess.Item, AbstractReadWriteAccess.Lockable, AbstractReadWriteAccess.SoftLockImpl
Constructor and Description |
---|
EntityReadWriteAccess(DomainDataRegion domainDataRegion,
CacheKeysFactory keysFactory,
DomainDataStorageAccess storageAccess,
EntityDataCachingConfig entityAccessConfig) |
Modifier and Type | Method and Description |
---|---|
boolean |
afterInsert(SharedSessionContractImplementor session,
Object key,
Object value,
Object version)
Called afterQuery an item has been inserted (afterQuery the transaction completes),
instead of calling release().
|
boolean |
afterUpdate(SharedSessionContractImplementor session,
Object key,
Object value,
Object currentVersion,
Object previousVersion,
SoftLock lock)
Called afterQuery an item has been updated (afterQuery the transaction completes),
instead of calling release().
|
Object |
generateCacheKey(Object id,
EntityPersister rootEntityDescriptor,
SessionFactoryImplementor factory,
String tenantIdentifier)
To create instances of keys for this region, Hibernate will invoke this method
exclusively so that generated implementations can generate optimised keys.
|
protected AccessedDataClassification |
getAccessedDataClassification() |
AccessType |
getAccessType()
The type of access implemented
|
Object |
getCacheKeyId(Object cacheKey)
|
protected Comparator |
getVersionComparator() |
boolean |
insert(SharedSessionContractImplementor session,
Object key,
Object value,
Object version)
Called afterQuery an item has been inserted (beforeQuery the transaction completes),
instead of calling evict().
|
SoftLock |
lockRegion()
Lock the entire region
|
void |
unlockRegion(SoftLock lock)
Called after we have finished the attempted invalidation of the entire
region
|
boolean |
update(SharedSessionContractImplementor session,
Object key,
Object value,
Object currentVersion,
Object previousVersion)
Called afterQuery an item has been updated (beforeQuery the transaction completes),
instead of calling evict().
|
decrementLock, get, handleLockExpiry, lockItem, nextLockId, putFromLoad, putFromLoad, readLock, remove, unlockItem, uuid, writeLock
clearCache, contains, destroy, evict, evictAll, getRegion, getStorageAccess, removeAll
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
contains, evict, evictAll, get, getRegion, lockItem, putFromLoad, putFromLoad, remove, removeAll, unlockItem
public EntityReadWriteAccess(DomainDataRegion domainDataRegion, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, EntityDataCachingConfig entityAccessConfig)
public AccessType getAccessType()
CachedDomainDataAccess
getAccessType
in interface CachedDomainDataAccess
protected AccessedDataClassification getAccessedDataClassification()
getAccessedDataClassification
in class AbstractReadWriteAccess
protected Comparator getVersionComparator()
getVersionComparator
in class AbstractReadWriteAccess
public Object generateCacheKey(Object id, EntityPersister rootEntityDescriptor, SessionFactoryImplementor factory, String tenantIdentifier)
EntityDataAccess
generateCacheKey
in interface EntityDataAccess
id
- the primary identifier of the entityrootEntityDescriptor
- Hierarchy for which a key is being generatedfactory
- a reference to the current SessionFactorytenantIdentifier
- the tenant id, or null if multi-tenancy is not being used.public Object getCacheKeyId(Object cacheKey)
EntityDataAccess
EntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
getCacheKeyId
in interface EntityDataAccess
cacheKey
- key previously returned from EntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
EntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
public boolean insert(SharedSessionContractImplementor session, Object key, Object value, Object version)
EntityDataAccess
insert
in interface EntityDataAccess
session
- Current sessionkey
- The item keyvalue
- The itemversion
- The item's version valuepublic boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version)
EntityDataAccess
afterInsert
in interface EntityDataAccess
session
- Current sessionkey
- The item keyvalue
- The itemversion
- The item's version valuepublic boolean update(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion)
EntityDataAccess
update
in interface EntityDataAccess
session
- Current sessionkey
- The item keyvalue
- The itemcurrentVersion
- The item's current version valuepreviousVersion
- The item's previous version valuepublic boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
EntityDataAccess
afterUpdate
in interface EntityDataAccess
session
- Current sessionkey
- The item keyvalue
- The itemcurrentVersion
- The item's current version valuepreviousVersion
- The item's previous version valuelock
- The lock previously obtained from CachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
public SoftLock lockRegion()
CachedDomainDataAccess
lockRegion
in interface CachedDomainDataAccess
lockRegion
in class AbstractCachedDomainDataAccess
null
.public void unlockRegion(SoftLock lock)
CachedDomainDataAccess
unlockRegion
in interface CachedDomainDataAccess
unlockRegion
in class AbstractCachedDomainDataAccess
lock
- The lock previously obtained from CachedDomainDataAccess.lockRegion()
Copyright © 2021 JBoss by Red Hat. All rights reserved.