Skip to content

Persistence DSL

The platform independent DSL “Persistence” defines module types, element types, member types and options that are used to define data structures. The DSL is named “Persistence”, but it is not necessary that the modeled data structure is going to be used to store data. Here you can see all defined types.

Module-Types Element-Types Member-Types
Persistence entity (extends type) none (only the inherited ones of “type”)



To be able to use the types and options you need to add “Persistence” to the module’s “kind” attribute.


module MyModule kind = Persistence;

Options for Module-Type “Persistence”

Option Option-Type Description
no options defined - -



An “entity” element is used to define a data structure. “entity” elements can have “field” members. A “field“‘s type can be a primitive type, an enumeration or another “entity” element.


entity Person {

    field firstName : Text;
    field lastName : Text;
    field gender : Gender;  // enumeration

    field addresses : Address { // entity
        set REST-HATEOAS = true;
        set CollectionType = List;
        set LazyLoading = true;

Options for Element-Type “entity”

Option Option-Type Description
Storable Boolean Defines, whether the entity’s data can be stored.
UtilityFields Boolean Defines, whether a generator should automatically add default fields to the “entity”, fields that are needed anyway. With this a modeler’s work gets easier. Fields for creation and modification timestamps are examples for this.
Nature Enumerated, single valued Possible value: Static, Transactional
Defines, whether a data structure is meant to be used for data that almost never changes (Static) or for data that constantly changes and where there are data records added all the time (Transactional). This information can be used by generators to optimize application performance or to generate test code only for important data structures (the Transactional ones).
Externalize Boolean Defines, whether it should be possible to convert the data in the data structure to a form that then can be used by other systems.

Members and Member-Options for Element-Type “type”

Member: field

More information on the member “field” can be found in the documentation of the DSL “Basic”.

Option Option-Type Description
Transient Boolean Defines, whether the data of the “field” should be stored or not.
Id Boolean Defines, whether the “field” is going to be used to uniquely identify a data record.
Length Numeric Defines the maximum size of the “field“‘s value.
MinimumLength Numeric Defines the minimum size of the “field“‘s value (e.g for a password field).
Unique Boolean Defines, whether all of the “field” values of all data records should be unique.
Mandatory Boolean Defines, whether there must be a value set for the “field”.
PrivatelyOwned Boolean Defines, whether all “entity” elements that are held in the value of the “field” cannot be used anywhere else (PrivatelyOwned=true). A consequence PrivatelyOwned=true is, that when the “entity” that owns the “field” is going to be deleted, all owned “entity” values of the “field” are deleted as well.
EnumerationType Enumerated, single valued Possible value: Ordinal, Literal
Defines, whether the value of an “enumeration” is going to be stored as number (Ordinal) or as text (Literal).
Binary Boolean Defines, whether the “field” data is going to be stored in binary format (e.g. as BLOB)
LazyLoading Boolean Defines, whether the data records represented by the “entity” are going to be loaded from a persistent storage onlay when the “field” is accessed for the very first time (LazyLoading=true).
CascadeTypes Enumerated, multi valued Possible values: All, None, Persist, Merge, Refresh, Remove
Defines, what the generated software shall do with “entity” values that are held in the “field” once the “entity” is
stored as a new data record (Persist)
  • an existing data record and is going to be modified (Merge)
  • an existing data record and the data has been modified but not yet persisted, and the original data shall be restored (Refresh)
  • an existing data record and the data record is going to be removed (Remove)
OrderBy Reference, multi valued References one or more “fields” of the “entity” that serves as the “field” type. Those referenced fields determine the order of the data records when they are read from a persistent storage.
RelatesTo Refrence, single valued References a “field” of another “entity”, whose type is the “entity” that owns the “field” where the “RelatesTo” is defined for. This reference links to fields together and defines a bi-directional relationship between the two owning “entities”.