Guidelines for Defining Related Entities in the Component Structure

When modeled entities are defined in a relationship, you must nest them in the component data structure. This defines the processing path from the outer entity to each inner entity.

The compiler recognizes a relationship between the entities and Uniface enforces the relationship. Uniface understands that the primary key of the one entity is also the foreign key of the many entity, and synchronizes updates for you.

  • Define the component fields of the primary key of the one entity and not the foreign key of the many entity.
  • Define a foreign key field only if:
    • The one entity to which it refers is not defined as a component entity on the component
    • The entities in the relationship are not nested inside each other
  • Do not define key fields more than once.

    This is not a problem if you nest an entity to establish a path to a related entity and you do not include fields for the outer entity.

  • Do not manipulate a foreign key with ProcScript, and avoid modifying the ProcScript in its leaveModifiedKey trigger.

    When related entities are nested inside each other, Uniface automatically handles the data transport from primary to foreign key. Manipulating the foreign key can interfere with this.

  • Outer entities can contain up to 64 child entities and be nested to a maximum depth of eight levels.

Related Topics