Let's say i have 3 domain classes:
class Book {
static belongsTo = [Author,User]
static hasMany = [authors:Author,usersWhomReadThisBook:User]
String title
}
class Author {
static hasMany = [books:Book]
String name
}
class User {
static hasMany = [booksRead:Book]
String name
}
belongsTo defines a cascading relationship so deleting a parent will delete all objects that belong to it.
Question is: when I delete a User does it cascade up and delete the Books the user have read? Even if it still belongs to an existing Author? Or does it only delete from the join table?
The documentation is not clear on this use case.