The Grails Framework 5.2.5

(Quick Reference) ## hasMany ### Purpose Defines a one-to-many association between two classes. ### Examples
    class Author {

        String name

        static hasMany = [books: Book]
    }
In this example we define a one-to-many relationship between the `Author` and `Book` classes (one `Author` has many `Book`s) ### Description By default GORM will create a property of type `java.util.Set` using the key inside the definition of the `hasMany` map. For example consider this definition:
    static hasMany = [books: Book]
Here a property of type `java.util.Set` called `books` will be created within the defining class. These can then be iterated over and manipulated:
    def a = Author.get(1)
    for (book in a.books) { println book.title }
| Quick Reference (hide)