Package org.hibernate.cache.spi.support
Class NaturalIdReadWriteAccess
- java.lang.Object
-
- org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
-
- org.hibernate.cache.spi.support.AbstractReadWriteAccess
-
- org.hibernate.cache.spi.support.NaturalIdReadWriteAccess
-
- All Implemented Interfaces:
CachedDomainDataAccess,NaturalIdDataAccess,AbstractDomainDataRegion.Destructible
public class NaturalIdReadWriteAccess extends AbstractReadWriteAccess implements NaturalIdDataAccess
Standard support forNaturalIdDataAccessusing theAccessType.READ_WRITEaccess type.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hibernate.cache.spi.support.AbstractReadWriteAccess
AbstractReadWriteAccess.Item, AbstractReadWriteAccess.Lockable, AbstractReadWriteAccess.SoftLockImpl
-
-
Constructor Summary
Constructors Constructor Description NaturalIdReadWriteAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, NaturalIdDataCachingConfig naturalIdDataCachingConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanafterInsert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value)Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release().booleanafterUpdate(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, SoftLock lock)Called afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release().java.lang.ObjectgenerateCacheKey(java.lang.Object[] naturalIdValues, EntityPersister rootEntityDescriptor, SharedSessionContractImplementor session)To create instances of NaturalIdCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.protected AccessedDataClassificationgetAccessedDataClassification()AccessTypegetAccessType()The type of access implementedjava.lang.Object[]getNaturalIdValues(java.lang.Object cacheKey)Performs reverse operation toNaturalIdDataAccess.generateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor), returning the original naturalIdValues.protected java.util.ComparatorgetVersionComparator()booleaninsert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value)Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict().booleanupdate(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value)Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict().-
Methods inherited from class org.hibernate.cache.spi.support.AbstractReadWriteAccess
decrementLock, get, handleLockExpiry, lockItem, nextLockId, putFromLoad, putFromLoad, readLock, remove, removeAll, unlockItem, uuid, writeLock
-
Methods inherited from class org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
clearCache, contains, destroy, evict, evictAll, getRegion, getStorageAccess, lockRegion, unlockRegion
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.cache.spi.access.CachedDomainDataAccess
contains, evict, evictAll, get, getRegion, lockItem, lockRegion, putFromLoad, putFromLoad, remove, removeAll, unlockItem, unlockRegion
-
-
-
-
Constructor Detail
-
NaturalIdReadWriteAccess
public NaturalIdReadWriteAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, NaturalIdDataCachingConfig naturalIdDataCachingConfig)
-
-
Method Detail
-
getAccessedDataClassification
protected AccessedDataClassification getAccessedDataClassification()
- Specified by:
getAccessedDataClassificationin classAbstractReadWriteAccess
-
getAccessType
public AccessType getAccessType()
Description copied from interface:CachedDomainDataAccessThe type of access implemented- Specified by:
getAccessTypein interfaceCachedDomainDataAccess
-
getVersionComparator
protected java.util.Comparator getVersionComparator()
- Specified by:
getVersionComparatorin classAbstractReadWriteAccess
-
generateCacheKey
public java.lang.Object generateCacheKey(java.lang.Object[] naturalIdValues, EntityPersister rootEntityDescriptor, SharedSessionContractImplementor session)Description copied from interface:NaturalIdDataAccessTo create instances of NaturalIdCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.- Specified by:
generateCacheKeyin interfaceNaturalIdDataAccess- Parameters:
naturalIdValues- the sequence of values which unequivocally identifies a cached element on this regionrootEntityDescriptor- the persister of the element being cached- Returns:
- a key which can be used to identify an element unequivocally on this same region
-
getNaturalIdValues
public java.lang.Object[] getNaturalIdValues(java.lang.Object cacheKey)
Description copied from interface:NaturalIdDataAccessPerforms reverse operation toNaturalIdDataAccess.generateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor), returning the original naturalIdValues.- Specified by:
getNaturalIdValuesin interfaceNaturalIdDataAccess- Parameters:
cacheKey- key returned fromNaturalIdDataAccess.generateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor)- Returns:
- the sequence of values which unequivocally identifies a cached element on this region
-
insert
public boolean insert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value)
Description copied from interface:NaturalIdDataAccessCalled afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.- Specified by:
insertin interfaceNaturalIdDataAccess- Parameters:
session- Current sessionkey- The item keyvalue- The item- Returns:
- Were the contents of the cache actually changed by this operation?
-
afterInsert
public boolean afterInsert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value)
Description copied from interface:NaturalIdDataAccessCalled afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.- Specified by:
afterInsertin interfaceNaturalIdDataAccess- Parameters:
session- Current sessionkey- The item keyvalue- The item- Returns:
- Were the contents of the cache actually changed by this operation?
-
update
public boolean update(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value)
Description copied from interface:NaturalIdDataAccessCalled afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.- Specified by:
updatein interfaceNaturalIdDataAccess- Parameters:
session- Current sessionkey- The item keyvalue- The item- Returns:
- Were the contents of the cache actually changed by this operation?
-
afterUpdate
public boolean afterUpdate(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, SoftLock lock)
Description copied from interface:NaturalIdDataAccessCalled afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.- Specified by:
afterUpdatein interfaceNaturalIdDataAccess- Parameters:
session- Current sessionkey- The item keyvalue- The itemlock- The lock previously obtained fromCachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)- Returns:
- Were the contents of the cache actually changed by this operation?
-
-