Relationships
Liferay 7.4 U47+/GA47+
Relationships add fields and tables to object definitions for relating their entries with one another. This provides access to entry data in different application contexts. You can use this data in different ways. For example, in scenarios with multiple business accounts, you can use relationships with the Account system object to restrict access to custom object data by account. Or you can use aggregation fields with relationships to perform basic calculations.
Root Objects
Liferay DXP 2025.Q1+/Portal GA132+
Some applications are comprised of many data models (i.e., object definitions), but it’s more convenient if they behave as a unified model. For these applications, defining a strong dependence of the child entities on the parent entity (i.e., the root model) can be beneficial.
While defining one-to-many relationships among your custom objects, you can make the parent object definition a root model in the structure by enabling inheritance.
You cannot enable inheritance for relationships involving system objects.
When inheritance is enabled,
- Child object definitions inherit permissions, including account restrictions from the root object definition.
- All API endpoints are grouped under the parent.
- The
relationship
field is always mandatory.
In a commerce orders application, the order and its child order item entities should be accessed and managed centrally, with the order as the root model object definition.
In Liferay, the Dataset Manager Application (release feature flag) uses the root model concept.
Use inheritance whenever you want a mandatory relationship between child and parent and identical permissions on the child and parent objects.
To enable root object inheritance, you must enable the release feature flag called Root Object Definitions (LPD-34594). Afterwards, you can toggle the Enable Inheritance checkbox while configuring a one to many relationship.