I'm trying to use the commandObject to validade my data when I submit my form. Can I validate a hasMany relation in commandObject. My cenario is something like this.
Tow simple classes whith hasMany relationship:
class Book{
    String nameBook
}
class Author{
    String nameAuthor
    static hasMany = [books:Book]    
}
Simple commandObject with hasMany that i want to validate when submit form.
@grails.validation.Validateable
class MyValidateCommand{
    String nameAuthor
    static hasMany = [books:Book]
    static constraints = {
        nameAuthor nullable:false
        books nullable:false
    }
}
Ps: I know that this commandObject is wrong, it don't compile. But can I do something like this ???
                        
hasManyin GORM is used for association in Domain objects. In case of command objects it will be a lucid approach to have different command objects for each domain (for example:AuthorCommandandBookCommand) and the command object would look like: