#1427 - QueryCache should be cleared, if one of a dependent bean is updated

Refactor on PostCommitProcessing with fixes for dependent table invalidation
This commit is contained in:
rob bygrave committed 2018-06-26 00:25:33 +12:00
1 parent 9159cec36c
commit ed566ca153
19 files changed
+262 -127

No files matched your search

@@ -56,6 +56,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
private String deleteByParentIdInSql;
private BeanPropertyAssocMany<?> relationshipProperty;
private boolean cacheNotifyRelationship;
/**
* Create based on deploy information of an EmbeddedId.
@@ -127,6 +128,13 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
}
}
/**
* Derive late in lifecycle cache notification on this relationship.
*/
public void initialisePostTarget() {
this.cacheNotifyRelationship = isCacheNotifyRelationship();
}
/**
* Return the property value as an entity bean.
*/
@@ -141,25 +149,31 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
/**
* Return true if this relationship needs to maintain/update L2 cache.
*/
boolean isCacheNotify() {
return targetDescriptor.isBeanCaching() && relationshipProperty != null;
boolean isCacheNotifyRelationship() {
return relationshipProperty != null && targetDescriptor.isBeanCaching();
}
/**
* Clear the L2 relationship cache for this property.
*/
void cacheClear() {
if (isCacheNotify()) {
if (cacheNotifyRelationship) {
targetDescriptor.cacheManyPropClear(relationshipProperty.getName());
}
}
void cacheClear(CacheChangeSet changeSet) {
if (cacheNotifyRelationship) {
changeSet.addManyClear(targetDescriptor, relationshipProperty.getName());
}
}
/**
* Clear part of the L2 relationship cache for this property.
*/
void cacheDelete(boolean clear, EntityBean bean, CacheChangeSet changeSet) {
if (isCacheNotify()) {
if (cacheNotifyRelationship) {
if (clear) {
changeSet.addManyClear(targetDescriptor, relationshipProperty.getName());
} else {