insert -> afterInsertlockItem -> remove -> update -> afterUpdatelockItem -> remove -> unlockItemputFromLoad
There is another usage pattern that is used to invalidate entries
afterQuery performing "bulk" HQL/SQL operations:
lockRegion -> removeAll -> unlockRegion
IMPORTANT : NaturalIds are not versioned so null will always be passed to the version parameter to:
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: Were the contents of the cache actually changed by this operation?Current session session, Object The item key key, Object The item value)Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release(). |
| public boolean | Returns: Were the contents of the cache actually changed by this operation?Current session session, Object The item key key, Object The item value, SoftLock The lock previously obtained from lock)lockItemCalled afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release(). |
| public Object | Returns: a key which can be used to identify an element unequivocally on this same regionthe sequence of values which unequivocally identifies a cached element on this region naturalIdValues, EntityPersister the persister of the element being cached rootEntityDescriptor, SharedSessionContractImplementor session)To create instances of NaturalIdCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys. |
| public Object[] | Returns: the sequence of values which unequivocally identifies a cached element on this regionkey returned from cacheKey)generateCacheKeyPerforms reverse operation to |
| public boolean | Returns: Were the contents of the cache actually changed by this operation?Current session session, Object The item key key, Object The item value)Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict(). |
| public boolean | Returns: Were the contents of the cache actually changed by this operation?Current session session, Object The item key key, Object The item value)Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict(). |
| afterInsert | back to summary |
|---|---|
| public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value) Called afterQuery an item has been inserted (afterQuery the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.
| |
| afterUpdate | back to summary |
|---|---|
| public boolean afterUpdate(SharedSessionContractImplementor session, Object key, Object value, SoftLock lock) Called afterQuery an item has been updated (afterQuery the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.
| |
| generateCacheKey | back to summary |
|---|---|
| public Object generateCacheKey(Object[] naturalIdValues, EntityPersister rootEntityDescriptor, SharedSessionContractImplementor session) To create instances of NaturalIdCacheKey for this region, Hibernate will invoke this method exclusively so that generated implementations can generate optimised keys.
| |
| getNaturalIdValues | back to summary |
|---|---|
| public Object[] getNaturalIdValues(Object cacheKey) Performs reverse operation to
| |
| insert | back to summary |
|---|---|
| public boolean insert(SharedSessionContractImplementor session, Object key, Object value) Called afterQuery an item has been inserted (beforeQuery the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.
| |
| update | back to summary |
|---|---|
| public boolean update(SharedSessionContractImplementor session, Object key, Object value) Called afterQuery an item has been updated (beforeQuery the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.
| |