fetchAll() only uses cache for preloaded data.
@@ -199,7 +199,13 @@ public class DataManager implements DataAccessObjectRegistry {
@SuppressWarnings("unchecked")
public <T extends WithId> ListResult<T> fetchAll(String kind, Function<ListResult<T>, ListResult<T>>... operators) {
- Map<String, WithId> cache = caches.getCache(kind);
+ Cache<String, WithId> cache = caches.getCache(kind);
+
+ //TODO: This is currently broken and needs to be properly addressed.
+ //... until then just use the cache for pre-loaded data.
+ if (cache.isEmpty()) {
+ return (ListResult<T>) doWithDataAccessObject(kind, d -> d.fetchAll());
+ }
ListResult<T> result = new ListResult.Builder<T>()
.items((Collection<T>) cache.values())
