Forwarding database
is a mechanism to perform additional logic before executing a query against a database. One example is to create a forwarding database that prevents returning cached query results, as in the following snippet.
ForwardingDatabase noCacheDatabase = new ForwardingDatabase() {
@Override
protected <T> Query<T> filterQuery(Query<T> query) {
return query.clone().noCache();
}
};
You can then use the no-cache forwarding database by specifying it in :
Query.from(User.class).using(noCacheDatabase).selectAll();
Because this query specified noCacheDatabase, Dari invokes the filterQuery method before executing the query.
Both Dari and Brightspot use ForwardingDatabase for a variety of scenarios. Here are a few examples:
- ¶Ù²¹°ù¾±â€™s&²Ô²ú²õ±è;
- µþ°ù¾±²µ³ó³Ù²õ±è´Ç³Ù’s&²Ô²ú²õ±è;
- µþ°ù¾±²µ³ó³Ù²õ±è´Ç³Ù’s&²Ô²ú²õ±è;
Previous Topic
Aggregate database
Next Topic
Transactions