gorm « Delete « JPA Q&A





1. How do you bulk delete records in Grails/GORM?    stackoverflow.com

I have a table which has records that need to be periodically cleared according to a set of criteria. I was expecting that I could use the criteria builder to just delete ...

2. grails deleted object would be re-saved by cascade error    stackoverflow.com

I have the project as set-up below. I am trying to delete a project, and I get the following:

2010-09-29 11:45:22,902 [http-8080-1] ERROR errors.GrailsExceptionResolver  - deleted object would be re-saved by ...

3. removeFrom with cascade all-delete-orphan does not work    stackoverflow.com

Grails 1.3.7 with MySQL 5.5 Either I must be doing something brain-dead, or this is related to Grails issues http://jira.grails.org/browse/GRAILS-5804 and http://jira.grails.org/browse/GRAILS-4121 and similar. I have:

class Author {
  ...

4. GORM delete operation : Found two representations of same collection    stackoverflow.com

@Entity
public class Contact{
    List associations

    static hasMany[
    associations:Contact
    ]

    static mapping[
    associations cascade:"all-delete-orphan"
 ...

5. Grails cascade delete?    stackoverflow.com

I'm going nuts with foreign key constraints here. No matter what I specify for cascading behavior or belongsTo/hasMany, I get a foreign-key constraint error I have this:

class A{
}

class B{
}

class C extends B ...

6. How can I tell if a Grails/GORM domain instance has been deleted in the current tx (Hibernate)?    stackoverflow.com

I am looking for a "isDeleted()" test for Grails (GORM) instances:

Project p = ... get persistent entity from somewhere ...
p.delete() // done in some nested logic
... sometime later in the code ...