Posts

Showing posts with the label PartOf modifier in Hybris

What is the PartOf modifier in Hybris items.xml?

What is PartOf? PartOf modifier is used to define the aggregation relationship between Parent and Child objects. To explain it better I would say PartOf is used to defining cascade delete.  When we delete a Parent object then all its child objects(partOf) will be deleted automatically. Why or When to use PartOf? PartOf may make sense when the relationship involves "is part of" description. For example, an OrderEntry record(AbstractOrderEntry) is part of its parent Order(AbstractOrder), and older entries will never be shared between multiple orders. If the Order were to vanish, the OrderEntry should as well, and an order entry without an Order would be a problem. How to use PartOf? On the removal of an order, if we want to remove all associated order entries automatically, then we can define partOf in its relation like <relation code="AbstractOrder2AbstractOrderEntry" localized="false" generate="true" autocreate="true&qu