public abstract class AbstractNaturalIdDataAccess extends AbstractCachedDomainDataAccess implements NaturalIdDataAccess
Constructor and Description |
---|
AbstractNaturalIdDataAccess(DomainDataRegion region,
CacheKeysFactory keysFactory,
DomainDataStorageAccess storageAccess,
NaturalIdDataCachingConfig config) |
Modifier and Type | Method and Description |
---|---|
boolean |
afterInsert(SharedSessionContractImplementor session,
Object key,
Object value)
Called afterQuery an item has been inserted (afterQuery the transaction completes),
instead of calling release().
|
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().
|
Object |
generateCacheKey(Object[] naturalIdValues,
EntityPersister persister,
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 to
NaturalIdDataAccess.generateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor) , returning
the original naturalIdValues. |
boolean |
insert(SharedSessionContractImplementor session,
Object key,
Object value)
Called afterQuery an item has been inserted (beforeQuery the transaction completes),
instead of calling evict().
|
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
|
boolean |
update(SharedSessionContractImplementor session,
Object key,
Object value)
Called afterQuery an item has been updated (beforeQuery the transaction completes),
instead of calling evict().
|
clearCache, contains, destroy, evict, evictAll, get, getRegion, getStorageAccess, putFromLoad, putFromLoad, remove, removeAll
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
contains, evict, evictAll, get, getAccessType, getRegion, putFromLoad, putFromLoad, remove, removeAll
public AbstractNaturalIdDataAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, NaturalIdDataCachingConfig config)
public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SharedSessionContractImplementor session)
NaturalIdDataAccess
generateCacheKey
in interface NaturalIdDataAccess
naturalIdValues
- the sequence of values which unequivocally identifies a cached element on this regionpersister
- the persister of the element being cachedpublic Object[] getNaturalIdValues(Object cacheKey)
NaturalIdDataAccess
NaturalIdDataAccess.generateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor)
, returning
the original naturalIdValues.getNaturalIdValues
in interface NaturalIdDataAccess
cacheKey
- key returned from NaturalIdDataAccess.generateCacheKey(java.lang.Object[], org.hibernate.persister.entity.EntityPersister, org.hibernate.engine.spi.SharedSessionContractImplementor)
public boolean insert(SharedSessionContractImplementor session, Object key, Object value)
NaturalIdDataAccess
insert
in interface NaturalIdDataAccess
session
- Current sessionkey
- The item keyvalue
- The itempublic boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value)
NaturalIdDataAccess
afterInsert
in interface NaturalIdDataAccess
session
- Current sessionkey
- The item keyvalue
- The itempublic boolean update(SharedSessionContractImplementor session, Object key, Object value)
NaturalIdDataAccess
update
in interface NaturalIdDataAccess
session
- Current sessionkey
- The item keyvalue
- The itempublic boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, SoftLock lock)
NaturalIdDataAccess
afterUpdate
in interface NaturalIdDataAccess
session
- Current sessionkey
- The item keyvalue
- The itemlock
- The lock previously obtained from CachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
public SoftLock lockRegion()
CachedDomainDataAccess
lockRegion
in interface CachedDomainDataAccess
lockRegion
in class AbstractCachedDomainDataAccess
null
.public void unlockRegion(SoftLock lock)
CachedDomainDataAccess
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
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
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 © 2019 JBoss by Red Hat. All rights reserved.