接口 NaturalIdDataAccess
-
- 所有超级接口:
CachedDomainDataAccess
- 所有已知实现类:
AbstractNaturalIdDataAccess,NaturalIdNonStrictReadWriteAccess,NaturalIdReadOnlyAccess,NaturalIdReadWriteAccess,NaturalIdTransactionalAccess
public interface NaturalIdDataAccess extends CachedDomainDataAccess
Contract for managing transactional and concurrent access to cached naturalId data. The expected call sequences related to various operations are:- INSERTS :
insert(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)->afterInsert(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object) - UPDATES :
CachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)->CachedDomainDataAccess.remove(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)->update(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)->afterUpdate(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object, org.hibernate.cache.spi.access.SoftLock) - DELETES :
CachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)->CachedDomainDataAccess.remove(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)->CachedDomainDataAccess.unlockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, org.hibernate.cache.spi.access.SoftLock) - LOADS :
CachedDomainDataAccess.putFromLoad(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object, java.lang.Object)
CachedDomainDataAccess.lockRegion()->CachedDomainDataAccess.removeAll(org.hibernate.engine.spi.SharedSessionContractImplementor)->CachedDomainDataAccess.unlockRegion(org.hibernate.cache.spi.access.SoftLock)IMPORTANT : NaturalIds are not versioned sonullwill always be passed to the version parameter to:- 作者:
- Gavin King, Steve Ebersole, Eric Dalquist
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 booleanafterInsert(SharedSessionContractImplementor session, Object key, Object value)Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release().booleanafterUpdate(SharedSessionContractImplementor session, Object key, Object value, SoftLock lock)Called afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release().ObjectgenerateCacheKey(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.Object[]getNaturalIdValues(Object cacheKey)Performs reverse operation togenerateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor), returning the original naturalIdValues.booleaninsert(SharedSessionContractImplementor session, Object key, Object value)Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict().booleanupdate(SharedSessionContractImplementor session, Object key, Object value)Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict().-
从接口继承的方法 org.hibernate.cache.spi.access.CachedDomainDataAccess
contains, evict, evictAll, get, getAccessType, getRegion, lockItem, lockRegion, putFromLoad, putFromLoad, remove, removeAll, unlockItem, unlockRegion
-
-
-
-
方法详细资料
-
generateCacheKey
Object generateCacheKey(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.- 参数:
naturalIdValues- the sequence of values which unequivocally identifies a cached element on this regionrootEntityDescriptor- the persister of the element being cached- 返回:
- a key which can be used to identify an element unequivocally on this same region
-
getNaturalIdValues
Object[] getNaturalIdValues(Object cacheKey)
Performs reverse operation togenerateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor), returning the original naturalIdValues.- 参数:
cacheKey- key returned fromgenerateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor)- 返回:
- the sequence of values which unequivocally identifies a cached element on this region
-
insert
boolean insert(SharedSessionContractImplementor session, Object key, Object value)
Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.- 参数:
session- Current sessionkey- The item keyvalue- The item- 返回:
- Were the contents of the cache actually changed by this operation?
- 抛出:
CacheException- Propagated from underlying cache provider
-
afterInsert
boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value)
Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.- 参数:
session- Current sessionkey- The item keyvalue- The item- 返回:
- Were the contents of the cache actually changed by this operation?
- 抛出:
CacheException- Propagated from underlying cache provider
-
update
boolean update(SharedSessionContractImplementor session, Object key, Object value)
Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.- 参数:
session- Current sessionkey- The item keyvalue- The item- 返回:
- Were the contents of the cache actually changed by this operation?
- 抛出:
CacheException- Propagated from underlying cache provider
-
afterUpdate
boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, SoftLock lock)
Called afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.- 参数:
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)- 返回:
- Were the contents of the cache actually changed by this operation?
- 抛出:
CacheException- Propagated from underlying cache provider
-
-