Package org.hibernate.cache.spi.access
Interface EntityDataAccess
-
- All Superinterfaces:
CachedDomainDataAccess
- All Known Implementing Classes:
AbstractEntityDataAccess
,EntityNonStrictReadWriteAccess
,EntityReadOnlyAccess
,EntityReadWriteAccess
,EntityTransactionalAccess
public interface EntityDataAccess extends CachedDomainDataAccess
Contract for managing transactional and concurrent access to cached entity data. The expected call sequences related to various operations are:- INSERTS :
insert(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object, java.lang.Object)
->afterInsert(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object, java.lang.Object)
- UPDATES :
CachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
->update(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)
->afterUpdate(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object, 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)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
afterInsert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object version)
Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release().boolean
afterUpdate(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object currentVersion, java.lang.Object previousVersion, SoftLock lock)
Called afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release().java.lang.Object
generateCacheKey(java.lang.Object id, EntityPersister rootEntityDescriptor, SessionFactoryImplementor factory, java.lang.String tenantIdentifier)
To create instances of keys for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.java.lang.Object
getCacheKeyId(java.lang.Object cacheKey)
boolean
insert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object version)
Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict().boolean
update(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object currentVersion, java.lang.Object previousVersion)
Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict().-
Methods inherited from interface org.hibernate.cache.spi.access.CachedDomainDataAccess
contains, evict, evictAll, get, getAccessType, getRegion, lockItem, lockRegion, putFromLoad, putFromLoad, remove, removeAll, unlockItem, unlockRegion
-
-
-
-
Method Detail
-
generateCacheKey
java.lang.Object generateCacheKey(java.lang.Object id, EntityPersister rootEntityDescriptor, SessionFactoryImplementor factory, java.lang.String tenantIdentifier)
To create instances of keys for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.- Parameters:
id
- the primary identifier of the entityrootEntityDescriptor
- Hierarchy 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 entity on this same region todo (6.0) : the access for an entity knows the entity hierarchy and the factory. why pass them in?
-
getCacheKeyId
java.lang.Object getCacheKeyId(java.lang.Object cacheKey)
Performs reverse operation togenerateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
- Parameters:
cacheKey
- key previously returned fromgenerateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
- Returns:
- original id passed to
generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
-
insert
boolean insert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object version)
Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.- Parameters:
session
- Current sessionkey
- The item keyvalue
- The itemversion
- The item's version value- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException
- Propagated from underlying cache provider
-
afterInsert
boolean afterInsert(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object version)
Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.- Parameters:
session
- Current sessionkey
- The item keyvalue
- The itemversion
- The item's version value- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException
- Propagated from underlying cache provider
-
update
boolean update(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object currentVersion, java.lang.Object previousVersion)
Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.- Parameters:
session
- Current sessionkey
- The item keyvalue
- The itemcurrentVersion
- The item's current version valuepreviousVersion
- The item's previous version value- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException
- Propagated from underlying cache provider
-
afterUpdate
boolean afterUpdate(SharedSessionContractImplementor session, java.lang.Object key, java.lang.Object value, java.lang.Object currentVersion, java.lang.Object previousVersion, 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.- Parameters:
session
- Current sessionkey
- The item keyvalue
- The itemcurrentVersion
- The item's current version valuepreviousVersion
- The item's previous version valuelock
- The lock previously obtained fromCachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
- Returns:
- Were the contents of the cache actual changed by this operation?
- Throws:
CacheException
- Propagated from underlying cache provider
-
-