Grails / GORM - equivalent to JPA @ElementCollection -
i have composition pattern parent object has list of child objects, e.g., order , lineitem.
it behaves similar cascading delete orphans, child objects @embeddables instead of @entities, , don't own ids - they're managed through parent object.
in jpa ensure whenever save order, collection of lineitems synchronize, including deleting removed items:
public class order { @elementcollection @collectiontable(...) private set<lineitem> items; }
in grails, what's equivalent?
i can hasmany cascade all-delete-orphan prefer if there similar way child objects not have own ids (basically, not entities).
you can use static embedded
in order
. refer this.
Comments
Post a Comment