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

public Class EntityReadWriteAccess

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

Standard support for org.hibernate.cache.spi.access.EntityDataAccess using the org.hibernate.cache.spi.access.AccessType#READ_WRITE access type.
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final CacheKeysFactory
private final Comparator<T>

Constructor Summary

AccessConstructor and Description
public
EntityReadWriteAccess(DomainDataRegion domainDataRegion, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, EntityDataCachingConfig entityAccessConfig)

Method Summary

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

Implements org.hibernate.cache.spi.access.EntityDataAccess.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
,
Object
The item's current version value
currentVersion
,
Object
The item's previous version value
previousVersion
,
SoftLock
The lock previously obtained from lockItem
lock
)

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

Called afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release().
public Object
generateCacheKey(Object
the primary identifier of the entity
id
,
EntityPersister
Hierarchy for which a key is being generated
rootEntityDescriptor
,
SessionFactoryImplementor
a reference to the current SessionFactory
factory
,
String
the tenant id, or null if multi-tenancy is not being used.
tenantIdentifier
)

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

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
To create instances of keys for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.
protected AccessedDataClassification
public AccessType
public Object
getCacheKeyId(Object
key previously returned from generateCacheKey
cacheKey
)

Implements org.hibernate.cache.spi.access.EntityDataAccess.getCacheKeyId.

Performs reverse operation to generateCacheKey
protected Comparator<T>
public boolean
insert(SharedSessionContractImplementor
Current session
session
,
Object
The item key
key
,
Object
The item
value
,
Object
The item's version value
version
)

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

Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict().
public SoftLock
public boolean
update(SharedSessionContractImplementor
Current session
session
,
Object
The item key
key
,
Object
The item
value
,
Object
The item's current version value
currentVersion
,
Object
The item's previous version value
previousVersion
)

Implements org.hibernate.cache.spi.access.EntityDataAccess.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
versionComparatorback to summary
private final Comparator<T> versionComparator

Constructor Detail

EntityReadWriteAccessback to summary
public EntityReadWriteAccess(DomainDataRegion domainDataRegion, CacheKeysFactory keysFactory, DomainDataStorageAccess storageAccess, EntityDataCachingConfig entityAccessConfig)

Method Detail

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

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

Doc from org.hibernate.cache.spi.access.EntityDataAccess.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

version:Object

The item's version value

Returns:boolean

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

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

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

Doc from org.hibernate.cache.spi.access.EntityDataAccess.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

currentVersion:Object

The item's current version value

previousVersion:Object

The item's previous version value

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 id, EntityPersister rootEntityDescriptor, SessionFactoryImplementor factory, String tenantIdentifier)

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

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

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

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

Parameters
id:Object

the primary identifier of the entity

rootEntityDescriptor:EntityPersister

Hierarchy for which a key is being generated

factory:SessionFactoryImplementor

a reference to the current SessionFactory

tenantIdentifier:String

the tenant id, or null if multi-tenancy is not being used.

Returns:Object

a key which can be used to identify this entity on this same region todo (6.0) : the access for an entity knows the entity hierarchy and the factory. why pass them in?

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
getCacheKeyIdback to summary
public Object getCacheKeyId(Object cacheKey)

Implements org.hibernate.cache.spi.access.EntityDataAccess.getCacheKeyId.

Doc from org.hibernate.cache.spi.access.EntityDataAccess.getCacheKeyId.

Performs reverse operation to generateCacheKey

Parameters
cacheKey:Object

key previously returned from generateCacheKey

Returns:Object

original id passed to generateCacheKey

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, Object version)

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

Doc from org.hibernate.cache.spi.access.EntityDataAccess.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

version:Object

The item's version value

Returns:boolean

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

Annotations
@Override
lockRegionback to summary
public SoftLock lockRegion()

Overrides org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess.lockRegion.

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

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

Lock the entire region

Returns:SoftLock

A representation of our lock on the item; or null.

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

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

Doc from org.hibernate.cache.spi.access.EntityDataAccess.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

currentVersion:Object

The item's current version value

previousVersion:Object

The item's previous version value

Returns:boolean

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

Annotations
@Override