Top Description Fields Constructors Methods
org.hibernate.cache.spi.support

public Class NaturalIdReadWriteAccess

extends AbstractReadWriteAccess
implements NaturalIdDataAccess
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.spi.access.NaturalIdDataAccess, org.hibernate.cache.spi.access.CachedDomainDataAccess
Imports
java.util.Comparator, org.hibernate.cache.cfg.spi.NaturalIdDataCachingConfig, org.hibernate.cache.spi.CacheKeysFactory, .DomainDataRegion, org.hibernate.cache.spi.access.AccessType, .NaturalIdDataAccess, .SoftLock, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.persister.entity.EntityPersister

Standard support for NaturalIdDataAccess using the AccessType#READ_WRITE access type.
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final CacheKeysFactory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
afterInsert(SharedSessionContractImplementor
Current session
session
,
Object
The item key
key
,
Object
The item
value
)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.afterInsert.

Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release().
public boolean
afterUpdate(SharedSessionContractImplementor
Current session
session
,
Object
The item key
key
,
Object
The item
value
,
SoftLock
The lock previously obtained from lockItem
lock
)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.afterUpdate.

Called afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release().
public Object
generateCacheKey(Object
the sequence of values which unequivocally identifies a cached element on this region
naturalIdValues
,
EntityPersister
the persister of the element being cached
rootEntityDescriptor
,
SharedSessionContractImplementor session)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.generateCacheKey.

To create instances of NaturalIdCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.
protected AccessedDataClassification
public AccessType
public Object
getNaturalIdValues(Object
key returned from generateCacheKey
cacheKey
)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.getNaturalIdValues.

Performs reverse operation to generateCacheKey, returning the original naturalIdValues.
protected Comparator<T>
public boolean
insert(SharedSessionContractImplementor
Current session
session
,
Object
The item key
key
,
Object
The item
value
)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.insert.

Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict().
public boolean
update(SharedSessionContractImplementor
Current session
session
,
Object
The item key
key
,
Object
The item
value
)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.update.

Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict().
Inherited from org.hibernate.cache.spi.support.AbstractReadWriteAccess:
decrementLockgethandleLockExpirylockItemnextLockIdputFromLoadputFromLoadreadLockremoveremoveAllunlockItemuuidwriteLock

Field Detail

keysFactoryback to summary
private final CacheKeysFactory keysFactory

Constructor Detail

NaturalIdReadWriteAccessback to summary
public NaturalIdReadWriteAccess(DomainDataRegion region, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, NaturalIdDataCachingConfig naturalIdDataCachingConfig)

Method Detail

afterInsertback to summary
public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.afterInsert.

Doc from org.hibernate.cache.spi.access.NaturalIdDataAccess.afterInsert.

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:SharedSessionContractImplementor

Current session

key:Object

The item key

value:Object

The item

Returns:boolean

Were the contents of the cache actually changed by this operation?

Annotations
@Override
afterUpdateback to summary
public boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, SoftLock lock)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.afterUpdate.

Doc from org.hibernate.cache.spi.access.NaturalIdDataAccess.afterUpdate.

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:SharedSessionContractImplementor

Current session

key:Object

The item key

value:Object

The item

lock:SoftLock

The lock previously obtained from lockItem

Returns:boolean

Were the contents of the cache actually changed by this operation?

Annotations
@Override
generateCacheKeyback to summary
public Object generateCacheKey(Object naturalIdValues, EntityPersister rootEntityDescriptor, SharedSessionContractImplementor session)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.generateCacheKey.

Doc from org.hibernate.cache.spi.access.NaturalIdDataAccess.generateCacheKey.

To create instances of NaturalIdCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.

Parameters
naturalIdValues:Object

the sequence of values which unequivocally identifies a cached element on this region

rootEntityDescriptor:EntityPersister

the persister of the element being cached

Returns:Object

a key which can be used to identify an element unequivocally on this same region

Annotations
@Override
getAccessedDataClassificationback to summary
protected AccessedDataClassification getAccessedDataClassification()

Implements abstract org.hibernate.cache.spi.support.AbstractReadWriteAccess.getAccessedDataClassification.

Annotations
@Override
getAccessTypeback to summary
public AccessType getAccessType()

Implements org.hibernate.cache.spi.access.CachedDomainDataAccess.getAccessType.

Doc from org.hibernate.cache.spi.access.CachedDomainDataAccess.getAccessType.

The type of access implemented

Annotations
@Override
getNaturalIdValuesback to summary
public Object getNaturalIdValues(Object cacheKey)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.getNaturalIdValues.

Doc from org.hibernate.cache.spi.access.NaturalIdDataAccess.getNaturalIdValues.

Performs reverse operation to generateCacheKey, returning the original naturalIdValues.

Parameters
cacheKey:Object

key returned from generateCacheKey

Returns:Object

the sequence of values which unequivocally identifies a cached element on this region

Annotations
@Override
getVersionComparatorback to summary
protected Comparator<T> getVersionComparator()

Implements abstract org.hibernate.cache.spi.support.AbstractReadWriteAccess.getVersionComparator.

Annotations
@Override
insertback to summary
public boolean insert(SharedSessionContractImplementor session, Object key, Object value)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.insert.

Doc from org.hibernate.cache.spi.access.NaturalIdDataAccess.insert.

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:SharedSessionContractImplementor

Current session

key:Object

The item key

value:Object

The item

Returns:boolean

Were the contents of the cache actually changed by this operation?

Annotations
@Override
updateback to summary
public boolean update(SharedSessionContractImplementor session, Object key, Object value)

Implements org.hibernate.cache.spi.access.NaturalIdDataAccess.update.

Doc from org.hibernate.cache.spi.access.NaturalIdDataAccess.update.

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:SharedSessionContractImplementor

Current session

key:Object

The item key

value:Object

The item

Returns:boolean

Were the contents of the cache actually changed by this operation?

Annotations
@Override