类 CollectionReadWriteAccess
- java.lang.Object
-
- org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
-
- org.hibernate.cache.spi.support.AbstractReadWriteAccess
-
- org.hibernate.cache.spi.support.CollectionReadWriteAccess
-
public class CollectionReadWriteAccess extends AbstractReadWriteAccess implements CollectionDataAccess
Standard support forCollectionDataAccessusing theAccessType.READ_WRITEaccess type.- 作者:
- Chris Cranford, Steve Ebersole
-
-
嵌套类概要
-
从类继承的嵌套类/接口 org.hibernate.cache.spi.support.AbstractReadWriteAccess
AbstractReadWriteAccess.Item, AbstractReadWriteAccess.Lockable, AbstractReadWriteAccess.SoftLockImpl
-
-
构造器概要
构造器 构造器 说明 CollectionReadWriteAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, CollectionDataCachingConfig config)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ObjectgenerateCacheKey(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.Objectget(SharedSessionContractImplementor session, Object key)Returnsnullif the item is not readable.protected AccessedDataClassificationgetAccessedDataClassification()AccessTypegetAccessType()The type of access implementedObjectgetCacheKeyId(Object cacheKey)protected ComparatorgetVersionComparator()SoftLocklockItem(SharedSessionContractImplementor session, Object key, Object version)We are going to attempt to update/delete the keyed object.booleanputFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version)Attempt to cache an object, afterQuery loading from the database.voidunlockItem(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.-
从类继承的方法 org.hibernate.cache.spi.support.AbstractReadWriteAccess
decrementLock, handleLockExpiry, nextLockId, putFromLoad, readLock, remove, removeAll, uuid, writeLock
-
从类继承的方法 org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
clearCache, contains, destroy, evict, evictAll, getRegion, getStorageAccess, lockRegion, unlockRegion
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 org.hibernate.cache.spi.access.CachedDomainDataAccess
contains, evict, evictAll, getRegion, lockRegion, putFromLoad, remove, removeAll, unlockRegion
-
-
-
-
构造器详细资料
-
CollectionReadWriteAccess
public CollectionReadWriteAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, CollectionDataCachingConfig config)
-
-
方法详细资料
-
getAccessedDataClassification
protected AccessedDataClassification getAccessedDataClassification()
-
getAccessType
public AccessType getAccessType()
从接口复制的说明:CachedDomainDataAccessThe type of access implemented- 指定者:
getAccessType在接口中CachedDomainDataAccess
-
generateCacheKey
public Object generateCacheKey(Object id, CollectionPersister collectionDescriptor, SessionFactoryImplementor factory, String tenantIdentifier)
从接口复制的说明:CollectionDataAccessTo create instances of CollectionCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.- 指定者:
generateCacheKey在接口中CollectionDataAccess- 参数:
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.- 返回:
- a key which can be used to identify this collection on this same region
-
getCacheKeyId
public Object getCacheKeyId(Object cacheKey)
从接口复制的说明:CollectionDataAccessPerforms reverse operation toCollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)- 指定者:
getCacheKeyId在接口中CollectionDataAccess- 参数:
cacheKey- key previously returned fromCollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)- 返回:
- original key passed to
CollectionDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.collection.CollectionPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
-
getVersionComparator
protected Comparator getVersionComparator()
-
get
public Object get(SharedSessionContractImplementor session, Object key)
从类复制的说明:AbstractReadWriteAccessReturnsnullif the item is not readable. Locked items are not readable, nor are items created afterQuery the start of this transaction.- 指定者:
get在接口中CachedDomainDataAccess- 覆盖:
get在类中AbstractReadWriteAccess- 参数:
session- Current session.key- The key of the item to be retrieved.- 返回:
- the cached data or
null
-
putFromLoad
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version)
从接口复制的说明:CachedDomainDataAccessAttempt to cache an object, afterQuery loading from the database.- 指定者:
putFromLoad在接口中CachedDomainDataAccess- 覆盖:
putFromLoad在类中AbstractReadWriteAccess- 参数:
session- Current session.key- The item keyvalue- The itemversion- the item version number- 返回:
trueif the object was successfully cached
-
lockItem
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version)
从接口复制的说明:CachedDomainDataAccessWe are going to attempt to update/delete the keyed object. This method is used by "asynchronous" concurrency strategies. The returned object must be passed back toCachedDomainDataAccess.unlockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, org.hibernate.cache.spi.access.SoftLock), to release the lock. Concurrency strategies which do not support client-visible locks may silently return null.- 指定者:
lockItem在接口中CachedDomainDataAccess- 覆盖:
lockItem在类中AbstractReadWriteAccess- 参数:
session- Current session.key- The key of the item to lockversion- The item's current version value- 返回:
- A representation of our lock on the item; or
null.
-
unlockItem
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock)
从接口复制的说明:CachedDomainDataAccessCalled when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion. This method is used by "asynchronous" concurrency strategies.- 指定者:
unlockItem在接口中CachedDomainDataAccess- 覆盖:
unlockItem在类中AbstractReadWriteAccess- 参数:
session- Current session.key- The item keylock- The lock previously obtained fromCachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
-
-