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

public abstract Class AbstractEntityDataAccess

extends AbstractCachedDomainDataAccess
implements EntityDataAccess
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.spi.access.EntityDataAccess, org.hibernate.cache.spi.access.CachedDomainDataAccess
Known Direct Subclasses
org.hibernate.cache.spi.support.EntityNonStrictReadWriteAccess, org.hibernate.cache.spi.support.EntityReadOnlyAccess, org.hibernate.cache.spi.support.EntityTransactionalAccess
Imports
org.hibernate.cache.spi.CacheKeysFactory, .DomainDataRegion, org.hibernate.cache.spi.access.EntityDataAccess, .SoftLock, org.hibernate.engine.spi.SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.persister.entity.EntityPersister

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 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.
public Object
getCacheKeyId(Object
key previously returned from generateCacheKey
cacheKey
)

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

Performs reverse operation to generateCacheKey
public SoftLock
lockItem(SharedSessionContractImplementor
Current session.
session
,
Object
The key of the item to lock
key
,
Object
The item's current version value
version
)

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

We are going to attempt to update/delete the keyed object.
public SoftLock
public void
unlockItem(SharedSessionContractImplementor
Current session.
session
,
Object
The item key
key
,
SoftLock
The lock previously obtained from lockItem
lock
)

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

Called when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion.
public void
unlockRegion(SoftLock
The lock previously obtained from lockRegion
lock
)

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

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

Called after we have finished the attempted invalidation of the entire region
Inherited from org.hibernate.cache.spi.support.AbstractCachedDomainDataAccess:
clearCachecontainsdestroyevictevictAllgetgetRegiongetStorageAccessputFromLoadputFromLoadremoveremoveAll

Field Detail

cacheKeysFactoryback to summary
private final CacheKeysFactory cacheKeysFactory

Constructor Detail

AbstractEntityDataAccessback to summary
public AbstractEntityDataAccess(DomainDataRegion region, CacheKeysFactory cacheKeysFactory, DomainDataStorageAccess storageAccess)

Method Detail

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
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
lockItemback to summary
public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version)

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

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

We are going to attempt to update/delete the keyed object. This method is used by "asynchronous" concurrency strategies.

The returned object must be passed back to unlockItem, to release the lock. Concurrency strategies which do not support client-visible locks may silently return null.

Parameters
session:SharedSessionContractImplementor

Current session.

key:Object

The key of the item to lock

version:Object

The item's current version value

Returns:SoftLock

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

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
unlockItemback to summary
public void unlockItem(SharedSessionContractImplementor session, Object key, SoftLock lock)

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

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

Called when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion. This method is used by "asynchronous" concurrency strategies.

Parameters
session:SharedSessionContractImplementor

Current session.

key:Object

The item key

lock:SoftLock

The lock previously obtained from lockItem

Annotations
@Override
unlockRegionback to summary
public void unlockRegion(SoftLock lock)

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

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

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

Called after we have finished the attempted invalidation of the entire region

Parameters
lock:SoftLock

The lock previously obtained from lockRegion

Annotations
@Override