Data Stores

When a Jmix application is created, the main data store already exists and can be accessed from the Jmix Tool Window.

data tree

By double-clicking, you can open the properties dialog of the data store. By default, HSQLDB is set as a database type.

data properties

The following properties are available both for the main and additional data stores:

  • Database type - type of the database server. You can select one of the available databases from the list.

  • Database URL - a host, port, and database name.

    • Connection params - other connection parameters. The format of the connection parameters depends on the selected DBMS. The string should include a separator between the database name and parameters. You can use the pencil button in the right part of the Connection params field to enter connection parameters conveniently. In this case, Studio automatically forms the connection string by adding DBMS-specific separator characters.

      data params
    • Show raw URL - shows connection parameters as URL.

    • Integrated Security - enables the corresponding authentication option when connecting to the Microsoft SQL Server 2012+ database.

  • Database user and Password - database connection credentials.

You can use placeholders of the following type ${VAR:default_value} where VAR is an environment variable to set database properties.

data vars

Studio resolves the placeholders and uses the resulting values for all operations with the database: test connection, recreate, update, Liquibase diff, and so on.

Additional Data Store

To create additional data store, use an action from the context menu. Another way is to select the one from Advanced:

data advanced

See the description of the database properties common for both the main and additional data stores above.

data schema

For the additional data store, specify Data store name and select an option in the DB Schema Management section:

  • Disabled - Studio doesn’t track database schema changes for this data store. This is the default mode.

  • Update Only - provides the Update action and creates Liquibase changelogs.

  • Create and Update - provides the Update and Recreate actions and creates Liquibase scripts.

Data Store Actions

By right-clicking the data store item in the Jmix project tree, you can open its context menu:

data actions

The number of actions shown in the menu depends on the data store type and DB schema management mode.

  • New → Additional Data Store - opens the dialog for creating a new data store.

  • New → Liquibase Changelog - generates a new changelog file with a correct name.

  • Manage Data Store - opens the dialog to edit data store settings.

  • Delete Data Store - removes the data store along with all associated configuration files and Liquibase changelogs.

  • Recreate - recreates database belonging to the selected data store. Applicable for the main data store and additional data stores with Create and Update schema management type.

  • Update - updates database schema for the selected data store. Applicable for the main data store and additional data stores with Update Only and Create and Update schema management types.

  • Generate Liquibase Changelog - generates changelog files for the selected data store by comparing data model with the database schema. Applicable for the main data store and additional data stores with Update Only and Create and Update schema management types.

    This feature requires a RAD or Enterprise subscription. If you don’t have the subscription, see how to get the trial version.

  • Check Liquibase Changelog Includes - checks that includes in the root changelog correspond to the add-ons used in the project. If there is a mismatch, Studio shows a notification dialog and suggests adding or removing includes.

  • Generate Model from Database - generates a data model from a database.

  • Jump to Source - opens a Spring configuration class.