20 Aug 2017

An easy way to clean ADF BC entity cache

It's time to get back to posting. In this short post, the first one after a long break,  I am going to show an easy way to clean up entity cache of a specific entity definition and to force dependent view objects to get re-executed.

Let's say there is a dashboard page containing lots of various charts, diagrams, lists and tables. All that fancy stuff is based on a number of view objects. Let's assume these view objects represent data in different ways from a database table containing some billing information BillingLog. So, there is an entity BillingLogEO and all dashboard VOs are based on this entity. When it comes to dashboards, a common use-case is to get the dashboard refreshed either manually or automatically. We could implement that just by running over all dashboard view objects and re-executing them one-by-one explicitly, or we can just tell the framework to clean up entity cache of BillingLogEO in our application module implementation class:
getDBTransaction().clearEntityCache("model.entities.BillingLogEO");
This will clean the specified entity cache in the current transaction and clean VO caches of all dependent view objects which will force them to get re-executed.

That's it!



No comments:

Post a comment

Post Comment