Brightspot CMS Developer Guide

Forwarding database


ForwardingDatabase 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#using:

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:

Previous Topic
Aggregate database
Next Topic
Transactions
Was this topic helpful?
Thanks for your feedback.
Our robust, flexible Design System provides hundreds of pre-built components you can use to build the presentation layer of your dreams.

Asset types
Module types
Page types
Brightspot is packaged with content types that get you up and running in a matter of days, including assets, modules and landing pages.

Content types
Modules
Landing pages
Everything you need to know when creating, managing, and administering content within Brightspot CMS.

Dashboards
Publishing
Workflows
Admin configurations
A guide for installing, supporting, extending, modifying and administering code on the Brightspot platform.

Field types
Content modeling
Rich-text elements
Images
A guide to configuring Brightspot's library of integrations, including pre-built options and developer-configured extensions.

Google Analytics
Shopify
Apple News