Class JdbcColumnPreferenceStorage

java.lang.Object
org.vaadin.addons.antlerflow.grid.columns.storage.ServerSideColumnPreferenceStorage
org.vaadin.addons.antlerflow.grid.columns.storage.JdbcColumnPreferenceStorage
All Implemented Interfaces:
Serializable, ColumnPreferenceStorage

public class JdbcColumnPreferenceStorage extends ServerSideColumnPreferenceStorage
Stores preferences per user in a relational database through plain JDBC, so they follow the user across browsers and devices. Works with any DataSource (Spring Boot's pooled one included) and any SQL database; no ORM is required.

Table (create it with your migrations from getCreateTableSql(), or call initializeSchema() once at startup):

CREATE TABLE af_grid_column_preference (
    user_id          VARCHAR(255)  NOT NULL,
    preference_key   VARCHAR(255)  NOT NULL,
    preference_value VARCHAR(4000) NOT NULL,
    PRIMARY KEY (user_id, preference_key)
)

preference_value holds one line per column, +id visible or -id hidden. Create one instance per application (for example a Spring bean) and share it.

The data source is not serialized with the session. If sessions are serialized (clustering, session persistence), set the storage on the grid when the view is created; a deserialized instance logs a warning and keeps the default columns instead of failing.

See Also: