A lifecycle dependency exists when one object governs the existence or removal of another. The dependent object belongs to the owner’s composition and cannot meaningfully exist alone. section 5.1.3
This distinction guides persistence mapping. A fully dependent object is usually a value type: it has no independent identity, cannot be shared, and follows the owner through saving, updating, and removal. An entity may still have a dependent lifecycle when future shared references require its own identity. section 5.1.3 section 8.3
Use these distinctions when choosing a mapping:
- Map a component as a value type when one owner exclusively controls it and it has no independent identity. section 5.1.3
- Treat a child as an entity when shared references may arise, even if its lifecycle remains dependent on the parent. section 5.1.3
- Distinguish lifecycle dependency from an ordinary entity association: associated entities can be saved, updated, or removed independently unless finer-grained rules are configured. section 8.3
Auction domain
An Item owns its Bid instances through composition, so removing the item removes its bids. If users later expose a collection of their bids, Bid gains shared references and needs entity identity while retaining a dependent lifecycle. Address remains a value type because one User exclusively owns it. section 5.1.3
Parent with images
An Item can own a collection of Image value types. The images are saved, updated, and removed with the Item, never independently; removing the Item also removes the image collection. section 8.3
Use the entity-and-value-type diagram to compare independent identity with composition-controlled lifecycles. section 5.1.3
