Using Object Inheritance
Liferay DXP 2025.Q1+/Portal GA132+
You can enhance the one-to-many relationship by enabling inheritance. When enabled, the one object in the one-to-many relationship becomes the root object that the child object entries inherit from.
When inheritance is enabled,
- Permissions are inherited from the root object.
- All API endpoints are grouped under the root object.
- The relationship field is always mandatory.
Understanding Root Objects
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.
Enabling Root Objects
-
Go to Control Panel → Instance Settings.
-
Enable the release feature flag called Root Object Definitions (LPD-34594).
-
Once enabled, you can toggle the Enable Inheritance checkbox while configuring a one-to-many relationship.
Using Workflow with Root Objects
Liferay DXP 2025.Q3+
If inheritance is enabled, a child object entry uses the workflow configuration of the parent object definition. For example, only one of the object definitions pictured below can be activated in the workflow: Country.
Any change to a parent or any of its children puts the whole root model, parent and children, into the workflow. Therefore, changing a child entry sends its parent into the workflow. If that parent is at the root of another inheritance structure, all its related children are now also in the workflow. One notification is sent and one workflow task must be completed.
Consider a parent object definition called Country with two child object definitions, Region and City. Inheritance is enabled on both relationships. In this structure, the single approver workflow can be activated for Country. Once activated, adding or updating a City causes the Region entries to become pending in the workflow, because its parent Country is now pending, and the Region’s status is dependent on its parent when inheritance is enabled.