How can I force the cache to update?
I have an entity that is actually a view in the database. I want force the cached entity to edit. Generally, when saving an entity, the cache is updated as well. But in this case, I cannot save the entity as it is a view. I therefore want to force the cache to refresh and read the updated values from the database.
How can I do this please?
Requery for the entity with a MergeStrategy of OverwriteChanges. Something like.
var entityKey = myEntity.entityAspect.getKey();
var query = EntityQuery.fromEntityKey(entityKey)
.using(MergeStrategy.OverwriteChanges);
myEntityManager.executeQuery(query).then(...);
After the promise resolves the latest version of the entity will be in cache.