PersistenceManageChildren

annotation class PersistenceManageChildren(val updateStrategy: OneToManyUpdateStrategy = OneToManyUpdateStrategy.UPSERT)(source)

Manages the target rows of a relation as owned children: they are created, updated, and deleted together with this entity.

Applies to PersistenceJoinOne, PersistenceJoinMany and PersistenceJoinManyThrough. Mutually exclusive with PersistenceManageLinks.

With DomainCreate, the generated create command contains a property named after the relation and typed as the target's create command (a list of them for a to-many relation). With DomainUpdate, only a PersistenceJoinMany with OneToManyUpdateStrategy.REPLACE_ALL is supported; a managed to-one child cannot be updated through the update command.

For a junction relation, target rows are deleted as well. Use PersistenceManageLinks instead when this entity owns only the junction links.

Using this annotation for a target shared with other parents may delete rows still referenced by those parents.

updateStrategy applies only to PersistenceJoinMany. PersistenceJoinManyThrough relations always replace their link rows completely.

Properties

Link copied to clipboard