command-objects

Grails command object data binding

爷,独闯天下 提交于 2019-11-27 18:47:37
Grails has very good support for binding request parameters to a domain object and it's associations. This largely relies on detecting request parameters that end with .id and automatically loading those from the database. However, it's not clear how to populate the associations of a command object. Take the following example: class ProductCommand { String name Collection<AttributeTypeCommand> attributeTypes ProductTypeCommand productType } This object has a single-ended association with ProductTypeCommand and a many-ended association with AttributeTypeCommand . The list of all attribute types