Delete object of my domain in grails e groovy

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Delete object of my domain in grails e groovy

Michele Medas

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")

If try to delete Author1

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.

You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit
For more options, visit