relational in grails code example
Example 1: relational in grails
//One-to-many
class Author {
static hasMany = [books: Book]
String name
}
///Other domain
class Book {
String title
}
Example 2: relational in grails
//Many-to-many
class Book {
static belongsTo = Author
static hasMany = [authors:Author]
String title
}
//Other domain
class Author {
static hasMany = [books:Book]
String name
}