public abstract class AbstractEntityDataAccess extends AbstractCachedDomainDataAccess implements EntityDataAccess
Constructor and Description |
---|
AbstractEntityDataAccess(DomainDataRegion region,
CacheKeysFactory cacheKeysFactory,
DomainDataStorageAccess storageAccess) |
Modifier and Type | Method and Description |
---|---|
Object |
generateCacheKey(Object id,
EntityPersister rootEntityDescriptor,
SessionFactoryImplementor factory,
String tenantIdentifier)
To create instances of keys for this region, Hibernate will invoke this method
exclusively so that generated implementations can generate optimised keys.
|
Object |
getCacheKeyId(Object cacheKey)
|
SoftLock |
lockItem(SharedSessionContractImplementor session,
Object key,
Object version)
We are going to attempt to update/delete the keyed object.
|
SoftLock |
lockRegion()
Lock the entire region
|
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.
|
void |
unlockRegion(SoftLock lock)
Called after we have finished the attempted invalidation of the entire
region
|
clearCache, contains, destroy, evict, evictAll, get, getRegion, getStorageAccess, putFromLoad, putFromLoad, remove, removeAll
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterInsert, afterUpdate, insert, update
contains, evict, evictAll, get, getAccessType, getRegion, putFromLoad, putFromLoad, remove, removeAll
public AbstractEntityDataAccess(DomainDataRegion region, CacheKeysFactory cacheKeysFactory, DomainDataStorageAccess storageAccess)
public Object generateCacheKey(Object id, EntityPersister rootEntityDescriptor, SessionFactoryImplementor factory, String tenantIdentifier)
EntityDataAccess
To create instances of keys for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.
generateCacheKey
in interface EntityDataAccess
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.public Object getCacheKeyId(Object cacheKey)
EntityDataAccess
Performs reverse operation to EntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
getCacheKeyId
in interface EntityDataAccess
cacheKey
- key previously returned from EntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
EntityDataAccess.generateCacheKey(java.lang.Object, org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SessionFactoryImplementor, java.lang.String)
public SoftLock lockRegion()
CachedDomainDataAccess
Lock the entire region
lockRegion
in interface CachedDomainDataAccess
lockRegion
in class AbstractCachedDomainDataAccess
null
.public void unlockRegion(SoftLock lock)
CachedDomainDataAccess
Called after we have finished the attempted invalidation of the entire region
unlockRegion
in interface CachedDomainDataAccess
unlockRegion
in class AbstractCachedDomainDataAccess
lock
- The lock previously obtained from CachedDomainDataAccess.lockRegion()
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version)
CachedDomainDataAccess
We are going to attempt to update/delete the keyed object. This
method is used by "asynchronous" concurrency strategies.
<p/>
The returned object must be passed back to CachedDomainDataAccess.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
in interface CachedDomainDataAccess
session
- Current session.key
- The key of the item to lockversion
- The item’s current version valuenull
.public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock)
CachedDomainDataAccess
Called 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
in interface CachedDomainDataAccess
session
- Current session.key
- The item keylock
- The lock previously obtained from CachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.