Package org.hibernate.cache.spi.support
Class EntityReadWriteAccess
java.lang.Object
org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
org.hibernate.cache.spi.support.AbstractReadWriteAccess
org.hibernate.cache.spi.support.EntityReadWriteAccess
- All Implemented Interfaces:
CachedDomainDataAccess,EntityDataAccess,AbstractDomainDataRegion.Destructible
Standard support for
EntityDataAccess
using the AccessType.READ_WRITE access type.-
Nested Class Summary
Nested classes/interfaces inherited from class org.hibernate.cache.spi.support.AbstractReadWriteAccess
AbstractReadWriteAccess.Item, AbstractReadWriteAccess.Lockable, AbstractReadWriteAccess.SoftLockImpl -
Constructor Summary
ConstructorsConstructorDescriptionEntityReadWriteAccess(DomainDataRegion domainDataRegion, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, EntityDataCachingConfig entityAccessConfig) -
Method Summary
Modifier and TypeMethodDescriptionbooleanafterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version) Called after an item has been inserted (after the transaction completes), instead of calling.invalid reference
#releasebooleanafterUpdate(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) Called after an item has been updated (after the transaction completes), instead of calling.invalid reference
#releasegenerateCacheKey(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 AccessedDataClassificationThe type of access implementedgetCacheKeyId(Object cacheKey) protected Comparatorbooleaninsert(SharedSessionContractImplementor session, Object key, Object value, Object version) Called after an item has been inserted (before the transaction completes), instead of callingCachedDomainDataAccess.evict(java.lang.Object).Lock the entire regionbooleanupdate(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion) Called after an item has been updated (before the transaction completes), instead of callingCachedDomainDataAccess.evict(java.lang.Object).Methods inherited from class org.hibernate.cache.spi.support.AbstractReadWriteAccess
decrementLock, get, handleLockExpiry, lockItem, nextLockId, putFromLoad, putFromLoad, readLock, remove, removeAll, unlockItem, uuid, writeLockMethods inherited from class org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
clearCache, contains, destroy, evict, evictAll, getRegion, getStorageAccess, unlockRegionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.cache.spi.access.CachedDomainDataAccess
contains, evict, evictAll, get, getRegion, lockItem, putFromLoad, putFromLoad, remove, removeAll, unlockItem, unlockRegion
-
Constructor Details
-
EntityReadWriteAccess
public EntityReadWriteAccess(DomainDataRegion domainDataRegion, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, EntityDataCachingConfig entityAccessConfig)
-
-
Method Details
-
getAccessType
Description copied from interface:CachedDomainDataAccessThe type of access implemented- Specified by:
getAccessTypein interfaceCachedDomainDataAccess
-
getAccessedDataClassification
- Specified by:
getAccessedDataClassificationin classAbstractReadWriteAccess
-
getVersionComparator
- Specified by:
getVersionComparatorin classAbstractReadWriteAccess
-
generateCacheKey
public Object generateCacheKey(Object id, EntityPersister rootEntityDescriptor, SessionFactoryImplementor factory, String tenantIdentifier) Description copied from interface:EntityDataAccessTo create instances of keys for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.- Specified by:
generateCacheKeyin interfaceEntityDataAccess- Parameters:
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.- Returns:
- a key which can be used to identify this entity on this same region todo (6.0) : the access for an entity knows the entity hierarchy and the factory. why pass them in?
-
getCacheKeyId
Description copied from interface:EntityDataAccessPerforms reverse operation toEntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)- Specified by:
getCacheKeyIdin interfaceEntityDataAccess- Parameters:
cacheKey- key previously returned fromEntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)- Returns:
- original id passed to
EntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
-
lockRegion
Description copied from interface:CachedDomainDataAccessLock the entire region- Specified by:
lockRegionin interfaceCachedDomainDataAccess- Overrides:
lockRegionin classAbstractCachedDomainDataAccess- Returns:
- A representation of our lock on the item; or
null.
-