Save This Page
Home » hibernate-distribution-3.3.1.GA-dist » org.hibernate » cache » access » [javadoc | source]
org.hibernate.cache.access
public interface: CollectionRegionAccessStrategy [javadoc | source]

All Known Implementing Classes:
    TransactionalAccess, CollectionAccessStrategyAdapter, OptimisticTransactionalAccess, ReadOnlyAccess, OptimisticReadOnlyAccess

Contract for managing transactional and concurrent access to cached collection data. For cached collection data, all modification actions actually just invalidate the entry(s). The call sequence here is: #lockItem -> #remove -> #unlockItem

There is another usage pattern that is used to invalidate entries after performing "bulk" HQL/SQL operations: #lockRegion -> #removeAll -> #unlockRegion

Method from org.hibernate.cache.access.CollectionRegionAccessStrategy Summary:
evict,   evictAll,   get,   getRegion,   lockItem,   lockRegion,   putFromLoad,   putFromLoad,   remove,   removeAll,   unlockItem,   unlockRegion
Method from org.hibernate.cache.access.CollectionRegionAccessStrategy Detail:
 public  void evict(Object key) throws CacheException
    Forcibly evict an item from the cache immediately without regard for transaction isolation.
 public  void evictAll() throws CacheException
    Forcibly evict all items from the cache immediately without regard for transaction isolation.
 public Object get(Object key,
    long txTimestamp) throws CacheException
    Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.
 public CollectionRegion getRegion()
    Get the wrapped collection cache region
 public SoftLock lockItem(Object key,
    Object version) throws CacheException
    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 release(), to release the lock. Concurrency strategies which do not support client-visible locks may silently return null.

 public SoftLock lockRegion() throws CacheException
    Lock the entire region
 public boolean putFromLoad(Object key,
    Object value,
    long txTimestamp,
    Object version) throws CacheException
    Attempt to cache an object, after loading from the database.
 public boolean putFromLoad(Object key,
    Object value,
    long txTimestamp,
    Object version,
    boolean minimalPutOverride) throws CacheException
    Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.
 public  void remove(Object key) throws CacheException
    Called after an item has become stale (before the transaction completes). This method is used by "synchronous" concurrency strategies.
 public  void removeAll() throws CacheException
    Called to evict data from the entire region
 public  void unlockItem(Object key,
    SoftLock lock) throws CacheException
    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.
 public  void unlockRegion(SoftLock lock) throws CacheException
    Called after we have finished the attempted invalidation of the entire region