Top Description Fields Constructors Methods
net.sf.ehcache.hibernate.strategy

public Class ReadOnlyEhcacheEntityRegionAccessStrategy

extends AbstractEhcacheAccessStrategy<EhcacheEntityRegion>
implements EntityRegionAccessStrategy
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.access.EntityRegionAccessStrategy
Imports
net.sf.ehcache.hibernate.regions.EhcacheEntityRegion, org.hibernate.cache.CacheException, .EntityRegion, org.hibernate.cache.access.EntityRegionAccessStrategy, .SoftLock, org.hibernate.cfg.Settings

Ehcache specific read-only entity region access strategy
Author
Chris Dennis

Field Summary

Inherited from net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy:
regionsettings

Constructor Summary

AccessConstructor and Description
public
ReadOnlyEhcacheEntityRegionAccessStrategy(EhcacheEntityRegion region, Settings settings)

Create a read-only access strategy accessing the given entity region.

Method Summary

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

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.afterInsert.

Called after an item has been inserted (after the transaction completes), instead of calling release().
public boolean
afterUpdate(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.access.EntityRegionAccessStrategy.afterUpdate.

Throws UnsupportedOperationException since this cache is read-only
public Object
get(Object
The key of the item to be retrieved.
key
,
long
a timestamp prior to the transaction start time
txTimestamp
)

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.get.

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

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.getRegion.

Get the wrapped entity cache region
public boolean
insert(Object
The item key
key
,
Object
The item
value
,
Object
The item's version value
version
)

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

This cache is asynchronous hence a no-op
public SoftLock
lockItem(Object
The key of the item to lock
key
,
Object
The item's current version value
version
)

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.lockItem.

Throws UnsupportedOperationException since this cache is read-only
public boolean
putFromLoad(Object
The item key
key
,
Object
The item
value
,
long
a timestamp prior to the transaction start time
txTimestamp
,
Object
the item version number
version
,
boolean
Explicit minimalPut flag
minimalPutOverride
)

Implements abstract net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy.putFromLoad.

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.putFromLoad.

Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.
public void
unlockItem(Object
The item key
key
,
SoftLock
The lock previously obtained from lockItem
lock
)

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.unlockItem.

A no-op since this cache is read-only
public boolean
update(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.access.EntityRegionAccessStrategy.update.

Throws UnsupportedOperationException since this cache is read-only
Inherited from net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy:
evictevictAlllockRegionputFromLoadremoveremoveAllunlockRegion

Constructor Detail

ReadOnlyEhcacheEntityRegionAccessStrategyback to summary
public ReadOnlyEhcacheEntityRegionAccessStrategy(EhcacheEntityRegion region, Settings settings)

Create a read-only access strategy accessing the given entity region.

Method Detail

afterInsertback to summary
public boolean afterInsert(Object key, Object value, Object version) throws CacheException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.afterInsert.

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterInsert.

Called after an item has been inserted (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.

Parameters
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?

Exceptions
CacheException:
Propogated from underlying org.hibernate.cache.Region
afterUpdateback to summary
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws UnsupportedOperationException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

Throws UnsupportedOperationException since this cache is read-only

Parameters
key:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

The item key

value:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

The item

currentVersion:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

The item's current version value

previousVersion:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

The item's previous version value

lock:SoftLock

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

The lock previously obtained from lockItem

Returns:boolean

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.afterUpdate.

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

Exceptions
UnsupportedOperationException:
always
getback to summary
public Object get(Object key, long txTimestamp) throws CacheException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.get.

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.get.

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

Parameters
key:Object

The key of the item to be retrieved.

txTimestamp:long

a timestamp prior to the transaction start time

Returns:Object

the cached object or null

Exceptions
CacheException:
Propogated from underlying org.hibernate.cache.Region
getRegionback to summary
public EntityRegion getRegion()

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.getRegion.

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.getRegion.

Get the wrapped entity cache region

Returns:EntityRegion

The underlying region

insertback to summary
public boolean insert(Object key, Object value, Object version) throws CacheException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

This cache is asynchronous hence a no-op

Parameters
key:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

The item key

value:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

The item

version:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

The item's version value

Returns:boolean

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

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

Exceptions
CacheException:

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.insert.

Propogated from underlying org.hibernate.cache.Region

lockItemback to summary
public SoftLock lockItem(Object key, Object version) throws UnsupportedOperationException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.lockItem.

Throws UnsupportedOperationException since this cache is read-only

Parameters
key:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.lockItem.

The key of the item to lock

version:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.lockItem.

The item's current version value

Returns:SoftLock

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.lockItem.

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

Exceptions
UnsupportedOperationException:
always
putFromLoadback to summary
public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException

Implements abstract net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy.putFromLoad.

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.putFromLoad.

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.putFromLoad.

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

Parameters
key:Object

The item key

value:Object

The item

txTimestamp:long

a timestamp prior to the transaction start time

version:Object

the item version number

minimalPutOverride:boolean

Explicit minimalPut flag

Returns:boolean

true if the object was successfully cached

Exceptions
CacheException:
Propogated from underlying org.hibernate.cache.Region
unlockItemback to summary
public void unlockItem(Object key, SoftLock lock) throws CacheException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.unlockItem.

A no-op since this cache is read-only

Parameters
key:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.unlockItem.

The item key

lock:SoftLock

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.unlockItem.

The lock previously obtained from lockItem

Exceptions
CacheException:

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.unlockItem.

Propogated from underlying org.hibernate.cache.Region

updateback to summary
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws UnsupportedOperationException

Implements org.hibernate.cache.access.EntityRegionAccessStrategy.update.

Throws UnsupportedOperationException since this cache is read-only

Parameters
key:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

The item key

value:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

The item

currentVersion:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

The item's current version value

previousVersion:Object

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

The item's previous version value

Returns:boolean

Doc from org.hibernate.cache.access.EntityRegionAccessStrategy.update.

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

Exceptions
UnsupportedOperationException:
always