Class CoherenceReadWriteNaturalIdAccess
- java.lang.Object
-
- com.oracle.coherence.hibernate.cache.v53.access.CoherenceReadWriteNaturalIdAccess
-
- All Implemented Interfaces:
org.hibernate.cache.spi.access.CachedDomainDataAccess
,org.hibernate.cache.spi.access.NaturalIdDataAccess
public class CoherenceReadWriteNaturalIdAccess extends Object implements org.hibernate.cache.spi.access.NaturalIdDataAccess
A CoherenceReadWriteNaturalIdAccess is a Coherence-based read-write region access strategy for Hibernate natural ID regions.- Author:
- Randy Stafford, Gunnar Hillert
-
-
Field Summary
Fields Modifier and Type Field Description static String
TRANSACTIONAL_STRATEGY_NOT_SUPPORTED_MESSAGE
The log message indicating lack of support for the transactional cache concurrency strategy.protected static String
WRITE_OPERATIONS_NOT_SUPPORTED_MESSAGE
A message indicating write operations are not supported in the read-only cache concurrency strategy.
-
Constructor Summary
Constructors Constructor Description CoherenceReadWriteNaturalIdAccess(org.hibernate.cache.spi.DomainDataRegion domainDataRegion, org.hibernate.cache.spi.support.DomainDataStorageAccess domainDataStorageAccess)
Complete constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
afterInsert(Object key, CoherenceRegionValue value)
Coherence-based implementation of behavior common to: 1.boolean
afterInsert(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value)
protected boolean
afterUpdate(Object key, CoherenceRegionValue value, org.hibernate.cache.spi.access.SoftLock softLock)
Coherence-based implementation of behavior common to: 1.boolean
afterUpdate(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value, org.hibernate.cache.spi.access.SoftLock lock)
boolean
contains(Object key)
void
evict(Object key)
void
evictAll()
Object
generateCacheKey(Object[] naturalIdValues, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.engine.spi.SharedSessionContractImplementor session)
Object
get(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key)
org.hibernate.cache.spi.access.AccessType
getAccessType()
protected org.hibernate.cache.spi.CacheKeysFactory
getCacheKeysFactory()
protected CoherenceRegion
getCoherenceRegion()
Returns the CoherenceRegion for which this is a AbstractCoherenceEntityDataAccess.Object[]
getNaturalIdValues(Object cacheKey)
org.hibernate.cache.spi.DomainDataRegion
getRegion()
protected org.hibernate.cache.spi.support.DomainDataStorageAccess
getStorageAccess()
protected UUID
getUuid()
Returns the UUID of this AbstractCoherenceEntityDataAccess.Comparator<?>
getVersionComparator()
boolean
insert(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value)
org.hibernate.cache.spi.access.SoftLock
lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object version)
org.hibernate.cache.spi.access.SoftLock
lockRegion()
protected CoherenceRegionValue
newCacheValue(Object value, Object version)
Returns a new cache value with the argument value and version.protected long
nextSoftLockSequenceNumber()
Returns the next sequence number for a SoftLock acquired by this AbstractCoherenceEntityDataAccess.boolean
putFromLoad(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value, Object version)
boolean
putFromLoad(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value, Object version, boolean minimalPutOverride)
void
remove(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key)
void
removeAll(org.hibernate.engine.spi.SharedSessionContractImplementor session)
String
toString()
}void
unlockItem(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, org.hibernate.cache.spi.access.SoftLock lock)
void
unlockRegion(org.hibernate.cache.spi.access.SoftLock lock)
boolean
update(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value)
-
-
-
Field Detail
-
TRANSACTIONAL_STRATEGY_NOT_SUPPORTED_MESSAGE
public static final String TRANSACTIONAL_STRATEGY_NOT_SUPPORTED_MESSAGE
The log message indicating lack of support for the transactional cache concurrency strategy.- See Also:
- Constant Field Values
-
WRITE_OPERATIONS_NOT_SUPPORTED_MESSAGE
protected static final String WRITE_OPERATIONS_NOT_SUPPORTED_MESSAGE
A message indicating write operations are not supported in the read-only cache concurrency strategy.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CoherenceReadWriteNaturalIdAccess
public CoherenceReadWriteNaturalIdAccess(org.hibernate.cache.spi.DomainDataRegion domainDataRegion, org.hibernate.cache.spi.support.DomainDataStorageAccess domainDataStorageAccess)
Complete constructor.- Parameters:
domainDataRegion
- the domain data regiondomainDataStorageAccess
- the domain data storage access
-
-
Method Detail
-
insert
public boolean insert(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value) throws org.hibernate.cache.CacheException
- Specified by:
insert
in interfaceorg.hibernate.cache.spi.access.NaturalIdDataAccess
- Throws:
org.hibernate.cache.CacheException
-
afterInsert
public boolean afterInsert(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value) throws org.hibernate.cache.CacheException
- Specified by:
afterInsert
in interfaceorg.hibernate.cache.spi.access.NaturalIdDataAccess
- Throws:
org.hibernate.cache.CacheException
-
update
public boolean update(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value) throws org.hibernate.cache.CacheException
- Specified by:
update
in interfaceorg.hibernate.cache.spi.access.NaturalIdDataAccess
- Throws:
org.hibernate.cache.CacheException
-
afterUpdate
public boolean afterUpdate(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value, org.hibernate.cache.spi.access.SoftLock lock) throws org.hibernate.cache.CacheException
- Specified by:
afterUpdate
in interfaceorg.hibernate.cache.spi.access.NaturalIdDataAccess
- Throws:
org.hibernate.cache.CacheException
-
generateCacheKey
public Object generateCacheKey(Object[] naturalIdValues, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.engine.spi.SharedSessionContractImplementor session)
- Specified by:
generateCacheKey
in interfaceorg.hibernate.cache.spi.access.NaturalIdDataAccess
-
getNaturalIdValues
public Object[] getNaturalIdValues(Object cacheKey)
- Specified by:
getNaturalIdValues
in interfaceorg.hibernate.cache.spi.access.NaturalIdDataAccess
-
getAccessType
public org.hibernate.cache.spi.access.AccessType getAccessType()
- Specified by:
getAccessType
in interfaceorg.hibernate.cache.spi.access.CachedDomainDataAccess
-
contains
public boolean contains(Object key)
- Specified by:
contains
in interfaceorg.hibernate.cache.spi.access.CachedDomainDataAccess
-
get
public Object get(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
lockItem
public org.hibernate.cache.spi.access.SoftLock lockItem(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object version) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
putFromLoad
public boolean putFromLoad(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value, Object version, boolean minimalPutOverride) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
unlockItem
public void unlockItem(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, org.hibernate.cache.spi.access.SoftLock lock) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
afterInsert
protected boolean afterInsert(Object key, CoherenceRegionValue value)
Coherence-based implementation of behavior common to: 1. org.hibernate.cache.spi.access.EntityRegionAccessStrategy.afterInsert(Object key, Object value, Object version) and 2. org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy.afterInsert(Object key, Object value). The only difference in implementation is that the cache value in a NaturalIdRegion will have a null version object.- Parameters:
key
- the key at which to insert a valuevalue
- the value to insert- Returns:
- a boolean indicating whether cache contents were modified
-
afterUpdate
protected boolean afterUpdate(Object key, CoherenceRegionValue value, org.hibernate.cache.spi.access.SoftLock softLock)
Coherence-based implementation of behavior common to: 1. org.hibernate.cache.spi.access.EntityRegionAccessStrategy.afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) and 2. org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy.afterUpdate(Object key, Object value, SoftLock lock). The only difference in implementation is that the cache value in a NaturalIdRegion will have a null version object.- Parameters:
key
- the key at which to insert a valuevalue
- the value to insertsoftLock
- the softLock acquired in an earlier lockItem call with the argument key- Returns:
- a boolean indicating whether cache contents were modified
-
getCoherenceRegion
protected CoherenceRegion getCoherenceRegion()
Returns the CoherenceRegion for which this is a AbstractCoherenceEntityDataAccess.- Returns:
- the CoherenceRegion for which this is a AbstractCoherenceEntityDataAccess
-
getRegion
public org.hibernate.cache.spi.DomainDataRegion getRegion()
-
getStorageAccess
protected org.hibernate.cache.spi.support.DomainDataStorageAccess getStorageAccess()
-
getVersionComparator
public Comparator<?> getVersionComparator()
-
getCacheKeysFactory
protected org.hibernate.cache.spi.CacheKeysFactory getCacheKeysFactory()
-
getUuid
protected UUID getUuid()
Returns the UUID of this AbstractCoherenceEntityDataAccess.- Returns:
- the UUID of this AbstractCoherenceEntityDataAccess
-
nextSoftLockSequenceNumber
protected long nextSoftLockSequenceNumber()
Returns the next sequence number for a SoftLock acquired by this AbstractCoherenceEntityDataAccess.- Returns:
- the long that is the next sequence number for a SoftLock acquired by this AbstractCoherenceEntityDataAccess
-
putFromLoad
public boolean putFromLoad(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key, Object value, Object version) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
lockRegion
public org.hibernate.cache.spi.access.SoftLock lockRegion() throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
unlockRegion
public void unlockRegion(org.hibernate.cache.spi.access.SoftLock lock) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
remove
public void remove(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object key) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
removeAll
public void removeAll(org.hibernate.engine.spi.SharedSessionContractImplementor session) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
evict
public void evict(Object key) throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
evictAll
public void evictAll() throws org.hibernate.cache.CacheException
- Throws:
org.hibernate.cache.CacheException
-
newCacheValue
protected CoherenceRegionValue newCacheValue(Object value, Object version)
Returns a new cache value with the argument value and version.- Parameters:
value
- the value for the new cache valueversion
- the version for the new cache value- Returns:
- a CoherenceRegion.Value with the argument value
-
-