This commit is contained in:
@@ -1029,8 +1029,8 @@ public final class DataDefaultSource implements DataSource, Nameable {
|
|||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
final EntityCache<T> cache = info.getCache();
|
final EntityCache<T> cache = info.getCache();
|
||||||
if (cache == null) return;
|
if (cache == null) return;
|
||||||
cache.update(value, attrs);
|
T rs = cache.update(value, attrs);
|
||||||
if (cacheListener != null) cacheListener.updateCache(clazz, value);
|
if (cacheListener != null) cacheListener.updateCache(clazz, rs);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -404,13 +404,14 @@ public final class EntityCache<T> {
|
|||||||
this.reproduce.copy(rs, value);
|
this.reproduce.copy(rs, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(final T value, Collection<Attribute<T, Serializable>> attrs) {
|
public T update(final T value, Collection<Attribute<T, Serializable>> attrs) {
|
||||||
if (value == null) return;
|
if (value == null) return value;
|
||||||
T rs = this.map.get(this.primary.get(value));
|
T rs = this.map.get(this.primary.get(value));
|
||||||
if (rs == null) return;
|
if (rs == null) return rs;
|
||||||
for (Attribute attr : attrs) {
|
for (Attribute attr : attrs) {
|
||||||
attr.set(rs, attr.get(value));
|
attr.set(rs, attr.get(value));
|
||||||
}
|
}
|
||||||
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <V> T update(final Serializable id, Attribute<T, V> attr, final V fieldValue) {
|
public <V> T update(final Serializable id, Attribute<T, V> attr, final V fieldValue) {
|
||||||
@@ -672,6 +673,12 @@ public final class EntityCache<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(FilterNode node) {
|
public boolean test(FilterNode node) {
|
||||||
|
if (node == null || node.isOr()) return false;
|
||||||
|
if (!attribute.field().equals(node.column)) return false;
|
||||||
|
if (node.nodes == null) return true;
|
||||||
|
for (FilterNode n : node.nodes) {
|
||||||
|
if (!test(n)) return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user