#702 - IllegalStateException: No bean cache enabled error ... when updating bean that is not using caching (but is related to a bean with @Cache)

This commit is contained in:
Robin Bygrave committed 2016-05-13 12:52:27 +12:00
1 parent 90a794fca5
commit 0e5859716b
5 files changed
+89 -25

No files matched your search

@@ -134,19 +134,28 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
this.relationshipProperty = relationshipProperty;
}
BeanPropertyAssocMany<?> getRelationshipProperty() {
return relationshipProperty;
/**
* Return true if this relationship needs to maintain/update L2 cache.
*/
boolean isCacheNotify() {
return targetDescriptor.isBeanCaching() && relationshipProperty != null;
}
/**
* Clear the L2 relationship cache for this property.
*/
void cacheClear() {
if (targetDescriptor.isBeanCaching() && relationshipProperty != null) {
if (isCacheNotify()) {
targetDescriptor.cacheManyPropClear(relationshipProperty.getName());
}
}
/**
* Clear part of the L2 relationship cache for this property.
*/
void cacheDelete(boolean clear, EntityBean bean, CacheChangeSet changeSet) {
if (targetDescriptor.isBeanCaching() && relationshipProperty != null) {
if (isCacheNotify()) {
if (clear) {
changeSet.addManyClear(targetDescriptor, relationshipProperty.getName());
} else {