Entity Data Task

When you want to manipulate with entities, it can be convenient to use Entity Data Task instead of Service Task. You can load entities from the database, modify them, and create the new ones.

Loading Entities

To load entities, you should select the task type in the properties panel. The modeler provides a JPQL editor to enter the code. The result of the query will be written in the specified process variable, but the type of the result is not known in advance. If you expect that the result will contain several elements, select Collection in the Save result as field.

load entity

If the result contains several elements and Single element was selected, then the very first element will be written into the specified process variable.

Modifying Entities

You can modify an entity that is written in the one of the existing process variables. Entity type will be detected automatically and all non-system attributes will be available for changes.

modify entity

Also, you can specify process variable name directly by typing its name. This is relevant when the result of the loading entities is an entity and has been written to the process variable. After that it is necessary to explicitly define entity type and proceed with specifying entity attributes.

Specifying Attributes

The value of the attribute can be specified in one of the following ways:

  • Specifying a direct value by typing in the field.

    direct value
  • Specifying an expression.

    expression
  • Using a Spring bean. By default, this option is disabled. To enable this variant in the list, set the property:

    jmix.bpm.data-task-spring-bean-entity-attribute-enabled=true
    spring bean

Creating Entities

To create an entity, select the entity name from the list and specify the process variable name the new entity will be written. All non-system attributes will be available for specifying using the visual editor.

create entity

Variants of defining values are described above.