Package org.hibernate.cache.spi.support
Class AbstractCollectionDataAccess
java.lang.Object
org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
org.hibernate.cache.spi.support.AbstractCollectionDataAccess
- All Implemented Interfaces:
CachedDomainDataAccess
,CollectionDataAccess
,AbstractDomainDataRegion.Destructible
- Direct Known Subclasses:
CollectionNonStrictReadWriteAccess
,CollectionReadOnlyAccess
,CollectionTransactionAccess
public abstract class AbstractCollectionDataAccess
extends AbstractCachedDomainDataAccess
implements CollectionDataAccess
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractCollectionDataAccess
(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, CollectionDataCachingConfig config) -
Method Summary
Modifier and TypeMethodDescriptiongenerateCacheKey
(Object id, CollectionPersister persister, 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.getCacheKeyId
(Object cacheKey) lockItem
(SharedSessionContractImplementor session, Object key, Object version) We are going to attempt to update/delete the keyed object.Lock the entire regionvoid
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.void
unlockRegion
(SoftLock lock) Called after we have finished the attempted invalidation of the entire regionMethods inherited from class org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
clearCache, contains, destroy, evict, evictAll, get, getRegion, getStorageAccess, putFromLoad, putFromLoad, remove, removeAll
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, getAccessType, getRegion, putFromLoad, putFromLoad, remove, removeAll
-
Constructor Details
-
AbstractCollectionDataAccess
public AbstractCollectionDataAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, CollectionDataCachingConfig config)
-
-
Method Details
-
generateCacheKey
public Object generateCacheKey(Object id, CollectionPersister persister, 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 Collectionpersister
- 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)
-
lockRegion
Description copied from interface:CachedDomainDataAccess
Lock the entire region- Specified by:
lockRegion
in interfaceCachedDomainDataAccess
- Overrides:
lockRegion
in classAbstractCachedDomainDataAccess
- Returns:
- A representation of our lock on the item; or
null
.
-
unlockRegion
Description copied from interface:CachedDomainDataAccess
Called after we have finished the attempted invalidation of the entire region- Specified by:
unlockRegion
in interfaceCachedDomainDataAccess
- Overrides:
unlockRegion
in classAbstractCachedDomainDataAccess
- Parameters:
lock
- The lock previously obtained fromCachedDomainDataAccess.lockRegion()
-