Concepts

This section explains the main concepts behind Dynamic Model: the kinds of entities involved, how the model is defined and versioned, how changes are applied at runtime, where the data is stored, and which databases are supported.

Static and Dynamic Entities

Dynamic Model distinguishes two kinds of entities:

  • Static entities are the regular entities of your application. They are compiled into Java classes and available on the classpath.

  • Dynamic entities are defined at runtime in the model and generated by the framework. They do not exist in the application source code.

Dynamic attributes can be added to both static and dynamic entities. This means you can enrich existing application entities with new attributes and, independently, introduce completely new entities that exist only in the runtime model.

Model Definition

The dynamic model is a declarative description of enumerations, entities, attributes, and views. You edit it graphically in the admin UI: you create entities, add attributes with their types and constraints, define enumerations, and declare views and menu items.

Behind the scenes, the model is serialized as YAML. You normally work with the graphical editor and do not edit the YAML directly, but the YAML form is useful for review, export, and import. For the full list of elements, supported values, and defaults, see YAML Reference.

Versioning and Deployment

The model definition is stored in the database as a set of versioned configurations. Only one version is active at a time. Keeping previous versions lets you review changes over time and roll back by activating an earlier version.

On application startup, the framework can automatically apply the active version so that the running application reflects the latest deployed model. This behavior is controlled by the jmix.dynmodel.deploy-on-app-start property.

Applying Changes

When you apply the model, the framework builds a new metadata generation from the model definition and publishes it atomically. Until the new generation is fully prepared, the running application keeps using the previous one, so a failed apply never exposes a partially applied model.

Destructive cleanup — such as dropping columns or tables that are no longer part of the model — is deferred until the previous generation is no longer used by in-flight work. This keeps running operations consistent while the model changes.

Already open views are not switched over automatically; they pick up the changes after a reload.

Storage

Dynamic Model keeps the runtime data in dedicated database tables:

  • Dynamic attributes of static entities are stored in separate side tables. By default, their names use the DYN_ prefix. A side table is created in the same physical data store as its owning static entity.

  • Dynamic entities get their own dedicated tables, also using the DYN_ prefix by default, with the primary key column DYNMOD_ID.

Each entity can specify a physical store through its store property; when omitted, the entity uses the main data store. References and collections are allowed only between entities that belong to the same physical store.

The table-name prefixes are configurable; see YAML Reference and Application Properties for the relevant settings.

Supported Databases

Dynamic Model supports the following databases:

  • HSQLDB

  • H2

  • PostgreSQL

  • MySQL 8+

  • MariaDB 10+

  • MS SQL Server 2012+

  • Oracle 12.2+