Unrelated Component Entities
Entities are unrelated if they have no relationship defined between them in the application model. When used in components, unrelated entities do not need to be nested.
In fact, nesting unrelated component entities is not recommended, although it is allowed. In this case, Uniface implements an ad hoc relationship, and the compiler issues a warning when you compile the component. You can maintain ad hoc relationships in the read, write, and delete triggers.
If you choose to nest unrelated entities, consider the following:
-
To force a relationship between the entities, use the read u_where statement in the read trigger of the inner entity. Otherwise, when you retrieve occurrences of the outer entity, all occurrences of the inner entity are retrieved.
-
If you define more than one outer entity with unrelated inner entities, Uniface retrieves data for the first outer entity only, as viewed from left to right and top to bottom. To retrieve data for the other unrelated entities, use the retrieve/e statement.
-
At runtime, when deleting an occurrence of an outer entity that contains one or more occurrences the inner entity, Uniface does the following:
-
Assumes that the two entities are related.
-
Assumes that the referential integrity constraint for delete is restricted.
-
Returns an error message.
-
If component entities are not nested, Uniface treats
them as unrelated. However, for components with Component Behavior set to
record
, this does not apply because the top left-most entity is expanded to
include any other entities painted.