Embedded (attribute of property)

From JRapid

Jump to: navigation, search

embedded is an attribute of property.

Its possible values are:



When a property is declared of type entity (we also call this an entity-property), it can specify the embedded attribute. This means that there exists a child entity that is strongly related (visually included or embedded) to this parent entity.

  • Embedded entities represent weak entities, so they map to cascade="all" hibernate relationships, and ondelete="cascade" at the database layer.

Single/Collection The child entity can be single (1-1) or collection (1-n).

  • When an entity-property is single (not collection), the only possible value is
    • detail will embed the same form of the child entity in the parent entity's form.
  • Single embedded entities appear in the database as a column of the parent-entity table.
  • When an entity-property is collection, the possible values are:
    • inline will embed child entity converting properties into rows.
    • detail will embed child entity using the full child form layout.
    • grid will embed child entity as inline, adding extra columns for special tagged properties.
  • Embedded collections need to specify a childproperty attribute, which specifies which property "links" to the parent entity.

Extendable/Non Extendable

  • If an embedded collection does not declare extendable, the collection is read-only (users cannot add new elements apart from the provided in the opening of the form).
  • For non-extendable inline collections, the values can be filled using foreach and dynamicforeach.

When a collection entity-property is embedded inline, the displayproperties attribute may be used to specify which properties of the child entity should be shown as columns. The displayproperties value is a comma separated list of the properties that should be used as columns. An extra set of properties may be specified separated by a semicolon from the fist group in order to create a "more" group. This adds one more column at the far right that provides a link that toggles the visibility of the extra properties.


         name = NAME
         label = LABEL
         entity = ENTITY
         collection = COLLECTION
         embedded = (inline|detail|grid)
         childproperty = PROPERTY
         maxrows = ROWS
         minrows = ROWS
         listindex = LIST_INDEX
         listunique = LIST_UNIQUE
         setorder = SETORDER
         sort = SORT
         sortexpr = EXPR
         where = WHERE
         extendable = "extendable"
         sortable = "sortable"
         gridheader = "gridheader"
         gridvalue = "gridvalue" 
         displayproperties = PROPERTIES
         (foreach?, dynamicforeach?, ...)


  • Embedded detail entity

A Company entity includes an Address entity as an embedded detail property. The Company may or may not have an Address.

File:Embedded (attribute of property) ex1 model.jpg

    <entity label="Company" menu="Main" name="Company">
        <property display="primary" label="Name" name="name"/>
        <property embedded="detail" entity="Address" label="Address" name="address" labelposition="fieldset"/>

    <entity label="Address" name="Address">
        <property label="Street" name="street"/>
        <property label="Number" name="number"/>
        <property label="City" name="city"/>

File:Embedded (attribute of property) ex1.jpg

  • Now, if a company can have more than one address it is necessary to use a collection property. It's a good idea to combine this with the inline value for the embedded attribute.

    <entity label="Person" menu="Menu" name="Person">
        <property display="primary" label="First Name" name="firstName"/>
        <property display="primary" label="Last Name" name="lastName"/>
        <property childproperty="person" collection="set" embedded="inline" 
            entity="Address" extendable="extendable" label="Address" name="address"/>

    <entity label="Address" name="Address">
        <property entity="Person" label="Person" name="person"/>
        <property display="primary" label="Address" name="address"/>
        <property display="primary" label="Zip Code" name="zipCode"/>
        <property display="primary" label="City" name="city"/>
        <property display="primary" entity="State" label="State" name="state"/>
        <property display="primary" entity="Country" label="Country" name="country"/>

Note that the extendable attribute is used to allow for new rows of address to be created.

Embedded inline example

See also

Personal tools