Using grails I build this domains:
class Book {
String title
}
class Author {
String name
static hasMany = [books: Book]
}
def book1 = new Book(title: "The Shining")
def author1 = new Author (name: "Stephen King")
author1.addToBooks(book1)
If try to delete Author1
author.books.clear()
Author1.delete flush:true
Get this error:
Message null Caused by Referential integrity constraint violation: "FKQG8TLCGMC6WKG6ILECFOXSLVS: PUBLIC.PROJECT_BOOK FOREIGN KEY(BOOK_AUTHOR_ID) REFERENCES PUBLIC.PROJECT_AUTHOR(ID) (1)"; SQL statement: delete from project_column where id=? and version=? [23503-195]
I would like to delete an author without deleting the books.