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

public abstract Class AbstractCachedDomainDataAccess

extends Object
implements CachedDomainDataAccess, Destructible
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.spi.support.AbstractDomainDataRegion.Destructible, org.hibernate.cache.spi.access.CachedDomainDataAccess
Known Direct Subclasses
org.hibernate.cache.spi.support.AbstractCollectionDataAccess, org.hibernate.cache.spi.support.AbstractEntityDataAccess, org.hibernate.cache.spi.support.AbstractNaturalIdDataAccess, org.hibernate.cache.spi.support.AbstractReadWriteAccess
Imports
org.hibernate.cache.spi.DomainDataRegion, org.hibernate.cache.spi.access.CachedDomainDataAccess, .SoftLock, org.hibernate.engine.spi.SharedSessionContractImplementor, org.jboss.logging.Logger

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private static final Logger
private final DomainDataRegion
private static final SoftLock
private final DomainDataStorageAccess

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected void
public boolean
contains(Object
The cache key
key
)

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

Determine whether this region contains data for the given key.
public void
public void
evict(Object
The key of the item to remove
key
)

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

Forcibly evict an item from the cache immediately without regard for transaction isolation and/or locking.
public void
evictAll()

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

Forcibly evict all items from the cache immediately without regard for transaction isolation.
public Object
get(SharedSessionContractImplementor
Current session.
session
,
Object
The key of the item to be retrieved.
key
)

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

Attempt to retrieve an object from the cache.
public DomainDataRegion
getRegion()

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

The region containing the data being accessed
protected DomainDataStorageAccess
public SoftLock
public boolean
putFromLoad(SharedSessionContractImplementor
Current session.
session
,
Object
The item key
key
,
Object
The item
value
,
Object
the item version number
version
)

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

Attempt to cache an object, afterQuery loading from the database.
public boolean
putFromLoad(SharedSessionContractImplementor
Current session.
session
,
Object
The item key
key
,
Object
The item
value
,
Object
the item version number
version
,
boolean
Explicit minimalPut flag
minimalPutOverride
)

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

Attempt to cache an object, afterQuery loading from the database, explicitly specifying the minimalPut behavior.
public void
remove(SharedSessionContractImplementor
Current session.
session
,
Object
The key of the item to remove
key
)

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

Called afterQuery an item has become stale (beforeQuery the transaction completes).
public void
public void
unlockRegion(SoftLock
The lock previously obtained from lockRegion
lock
)

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

Called after we have finished the attempted invalidation of the entire region
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private static final Logger log
regionback to summary
private final DomainDataRegion region
REGION_LOCKback to summary
private static final SoftLock REGION_LOCK
storageAccessback to summary
private final DomainDataStorageAccess storageAccess

Constructor Detail

AbstractCachedDomainDataAccessback to summary
protected AbstractCachedDomainDataAccess(DomainDataRegion region, DomainDataStorageAccess storageAccess)

Method Detail

clearCacheback to summary
protected void clearCache()
containsback to summary
public boolean contains(Object key)

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

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

Determine whether this region contains data for the given key.

The semantic here is whether the cache contains data visible for the current call context. This should be viewed as a "best effort", meaning blocking should be avoided if possible.

Parameters
key:Object

The cache key

Returns:boolean

True if the underlying cache contains corresponding data; false otherwise.

Annotations
@Override
destroyback to summary
public void destroy()

Implements org.hibernate.cache.spi.support.AbstractDomainDataRegion.Destructible.destroy.

Annotations
@Override
evictback to summary
public void evict(Object key)

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

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

Forcibly evict an item from the cache immediately without regard for transaction isolation and/or locking. This behavior is exactly Hibernate legacy behavior, but it is also required by JPA - so we cannot remove it.

Used from JPA's javax.persistence.Cache#evict(Class, Object), as well as the Hibernate extension org.hibernate.Cache#evictEntityData(Class, Serializable) and org.hibernate.Cache#evictEntityData(String, Serializable)

Parameters
key:Object

The key of the item to remove

Annotations
@Override
evictAllback to summary
public void evictAll()

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

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

Forcibly evict all items from the cache immediately without regard for transaction isolation. This behavior is exactly Hibernate legacy behavior, but it is also required by JPA - so we cannot remove it.

Used from our JPA impl of Cache#evictAll() as well as the Hibernate extensions org.hibernate.Cache#evictEntityData(Class), org.hibernate.Cache#evictEntityData(String) and org.hibernate.Cache#evictEntityData()

Annotations
@Override
getback to summary
public Object get(SharedSessionContractImplementor session, Object key)

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

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

Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.

Parameters
session:SharedSessionContractImplementor

Current session.

key:Object

The key of the item to be retrieved.

Returns:Object

the cached data or null

Annotations
@Override
getRegionback to summary
public DomainDataRegion getRegion()

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

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

The region containing the data being accessed

Annotations
@Override
getStorageAccessback to summary
protected DomainDataStorageAccess getStorageAccess()
lockRegionback to summary
public SoftLock 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
putFromLoadback to summary
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version)

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

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

Attempt to cache an object, afterQuery loading from the database.

Parameters
session:SharedSessionContractImplementor

Current session.

key:Object

The item key

value:Object

The item

version:Object

the item version number

Returns:boolean

true if the object was successfully cached

Annotations
@Override
putFromLoadback to summary
public boolean putFromLoad(SharedSessionContractImplementor session, Object key, Object value, Object version, boolean minimalPutOverride)

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

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

Attempt to cache an object, afterQuery loading from the database, explicitly specifying the minimalPut behavior.

Parameters
session:SharedSessionContractImplementor

Current session.

key:Object

The item key

value:Object

The item

version:Object

the item version number

minimalPutOverride:boolean

Explicit minimalPut flag

Returns:boolean

true if the object was successfully cached

Annotations
@Override
removeback to summary
public void remove(SharedSessionContractImplementor session, Object key)

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

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

Called afterQuery an item has become stale (beforeQuery the transaction completes). This method is used by "synchronous" concurrency strategies.

Parameters
session:SharedSessionContractImplementor

Current session.

key:Object

The key of the item to remove

Annotations
@Override
removeAllback to summary
public void removeAll(SharedSessionContractImplementor session)

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

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

Remove all data for this accessed type

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

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