Package org.hibernate.cache.spi.support
Class CollectionReadWriteAccess
java.lang.Object
org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
org.hibernate.cache.spi.support.AbstractReadWriteAccess
org.hibernate.cache.spi.support.CollectionReadWriteAccess
- All Implemented Interfaces:
CachedDomainDataAccess
,CollectionDataAccess
,AbstractDomainDataRegion.Destructible
public class CollectionReadWriteAccess
extends AbstractReadWriteAccess
implements CollectionDataAccess
Standard support for
CollectionDataAccess
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
ConstructorsConstructorDescriptionCollectionReadWriteAccess
(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, CollectionDataCachingConfig config) -
Method Summary
Modifier and TypeMethodDescriptiongenerateCacheKey
(Object id, CollectionPersister collectionDescriptor, SessionFactoryImplementor factory, String tenantIdentifier) To create instances of CollectionCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.get
(SharedSessionContractImplementor session, Object key) Returnsnull
if the item is not readable.protected AccessedDataClassification
The type of access implementedgetCacheKeyId
(Object cacheKey) protected Comparator
lockItem
(SharedSessionContractImplementor session, Object key, Object version) We are going to attempt to update/delete the keyed object.boolean
putFromLoad
(SharedSessionContractImplementor session, Object key, Object value, Object version) Attempt to cache an object, afterQuery loading from the database.void
unlockItem
(SharedSessionContractImplementor session, Object key, SoftLock lock) Called when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion.Methods inherited from class org.hibernate.cache.spi.support.AbstractReadWriteAccess
decrementLock, handleLockExpiry, nextLockId, putFromLoad, readLock, remove, removeAll, 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, getRegion, lockRegion, putFromLoad, remove, removeAll, unlockRegion
-
Constructor Details
-
CollectionReadWriteAccess
public CollectionReadWriteAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, CollectionDataCachingConfig config)
-
-
Method Details
-
getAccessedDataClassification
- Specified by:
getAccessedDataClassification
in classAbstractReadWriteAccess
-
getAccessType
Description copied from interface:CachedDomainDataAccess
The type of access implemented- Specified by:
getAccessType
in interfaceCachedDomainDataAccess
-
generateCacheKey
public Object generateCacheKey(Object id, CollectionPersister collectionDescriptor, SessionFactoryImplementor factory, String tenantIdentifier) Description copied from interface:CollectionDataAccess
To create instances of CollectionCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.- Specified by:
generateCacheKey
in interfaceCollectionDataAccess
- Parameters:
id
- the primary identifier of the CollectioncollectionDescriptor
- the descriptor of the collection 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 collection on this same region
-
getCacheKeyId
Description copied from interface:CollectionDataAccess
Performs reverse operation toCollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
- Specified by:
getCacheKeyId
in interfaceCollectionDataAccess
- Parameters:
cacheKey
- key previously returned fromCollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
- Returns:
- original key passed to
CollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
-
getVersionComparator
- Specified by:
getVersionComparator
in classAbstractReadWriteAccess
-