Reduce count of entites which are evicted from 2nd level cache on update
------------------------------------------------------------------------
Key: HHH-2296
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2296
Project: Hibernate3
Type: Improvement
Components: core
Environment: Hibernate 3.2 cr2/cr3, JBoss TreeCache/EhCache, Oracle
Reporter: Veklov Alexey
Priority: Trivial
There is code snippet from EntityUpdateAction.execute:
if ( persister.hasCache() ) {
if ( persister.isCacheInvalidationRequired() || entry.getStatus()!=Status.MANAGED ) {
persister.getCache().evict(ck);
}
else {
AbstractEntityPersister.isCacheInvalidationRequired has the following comment:
/**
* We can't immediately add to the cache if we have formulas
* which must be evaluated, or if we have the possibility of
* two concurrent updates to the same item being merged on
* the database. This can happen if (a) the item is not
* versioned and either (b) we have dynamic update enabled
* or (c) we have multiple tables holding the state of the
* item.
*/
public boolean isCacheInvalidationRequired() {
return hasFormulaProperties() ||
( !isVersioned() && ( entityMetamodel.isDynamicUpdate() || getTableSpan()
> 1 ) );
}
This logic does not take into account that if we have obtained pessimistic lock on entity
through
select ... from <join of all tables holding the state> for update
which is fired by Session.refresh(..., LockMode.UPGRADE)
concurrent updates are impossible.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira