Package org.hibernate.cache.spi.support
Class EntityNonStrictReadWriteAccess
- java.lang.Object
-
- org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
-
- org.hibernate.cache.spi.support.AbstractEntityDataAccess
-
- org.hibernate.cache.spi.support.EntityNonStrictReadWriteAccess
-
- All Implemented Interfaces:
CachedDomainDataAccess
,EntityDataAccess
,AbstractDomainDataRegion.Destructible
public class EntityNonStrictReadWriteAccess extends AbstractEntityDataAccess
Standard support forEntityDataAccess
using theAccessType.NONSTRICT_READ_WRITE
access type.
-
-
Constructor Summary
Constructors Constructor Description EntityNonStrictReadWriteAccess(DomainDataRegion domainDataRegion, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, EntityDataCachingConfig entityAccessConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
afterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version)
Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release().boolean
afterUpdate(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
Called afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release().AccessType
getAccessType()
The type of access implementedboolean
insert(SharedSessionContractImplementor session, Object key, Object value, Object version)
Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict().void
remove(SharedSessionContractImplementor session, Object key)
Called afterQuery an item has become stale (beforeQuery the transaction completes).void
unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock)
Since this is a non-strict read/write strategy item locking is not used.boolean
update(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion)
Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict().-
Methods inherited from class org.hibernate.cache.spi.support.AbstractEntityDataAccess
generateCacheKey, getCacheKeyId, lockItem, lockRegion, unlockRegion
-
Methods inherited from class org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess
clearCache, contains, destroy, evict, evictAll, get, getRegion, getStorageAccess, putFromLoad, putFromLoad, removeAll
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.cache.spi.access.CachedDomainDataAccess
contains, evict, evictAll, get, getRegion, putFromLoad, putFromLoad, removeAll
-
-
-
-
Constructor Detail
-
EntityNonStrictReadWriteAccess
public EntityNonStrictReadWriteAccess(DomainDataRegion domainDataRegion, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, EntityDataCachingConfig entityAccessConfig)
-
-
Method Detail
-
getAccessType
public AccessType getAccessType()
Description copied from interface:CachedDomainDataAccess
The type of access implemented
-
insert
public boolean insert(SharedSessionContractImplementor session, Object key, Object value, Object version)
Description copied from interface:EntityDataAccess
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 actually changed by this operation?
-
afterInsert
public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version)
Description copied from interface:EntityDataAccess
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?
-
update
public boolean update(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion)
Description copied from interface:EntityDataAccess
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 actually changed by this operation?
-
afterUpdate
public boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
Description copied from interface:EntityDataAccess
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 actually changed by this operation?
-
unlockItem
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock) throws CacheException
Since this is a non-strict read/write strategy item locking is not used.- Specified by:
unlockItem
in interfaceCachedDomainDataAccess
- Overrides:
unlockItem
in classAbstractEntityDataAccess
- Parameters:
session
- Current session.key
- The item keylock
- The lock previously obtained fromCachedDomainDataAccess.lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object, java.lang.Object)
- Throws:
CacheException
- Propagated from underlying cache provider
-
remove
public void remove(SharedSessionContractImplementor session, Object key)
Description copied from interface:CachedDomainDataAccess
Called afterQuery an item has become stale (beforeQuery the transaction completes). This method is used by "synchronous" concurrency strategies.- Specified by:
remove
in interfaceCachedDomainDataAccess
- Overrides:
remove
in classAbstractCachedDomainDataAccess
- Parameters:
session
- Current session.key
- The key of the item to remove
-
-