Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4326982
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:28:27+00:00 2026-05-21T09:28:27+00:00

Grails 1.3.7 with MySQL 5.5 Either I must be doing something brain-dead, or this

  • 0

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 {
    String name
    static hasMany = [books: Book]
    static constraints = {
        books cascade: 'all-delete-orphan'
    }
    String toString() {
        return name
    }
}

class Book {
    String title
    static belongsTo = [author: Author]
    static constraints = {
    }
    String toString() {
        return title
    }
}

Bootstrap:
def a = new Author(name: 'Author0')
a.save(flush: true, failOnError: true)      
def b = new Book(title: 'Book0')
a.addToBooks(b).save(flush: true, failOnError: true)

class AuthorController {
    def index = {
        println("Controller code: " + "Old books by author: " + Author.get(1).books)
        def author = Author.findByName("Author0")
        def oldBooks = []
        oldBooks += author.books  // to avoid ConcurrentModificationException
        oldBooks.each {
            author.removeFromBooks(it)
        }
        author.save(flush: true, failOnError: true)
        println("Controller code: " + "New books by author: " + Author.get(1).books)
            render("All done!")
        }
    }

But when I navigate to localhost:8080/foo/author/index I get a ‘not-null property references a null or transient value: foo.Book.author’ during the save()

I don’t really know GORM-internals or Hibernate (proxied vs unproxied instances), I tried all combinations of using ‘get’ instead of ‘find’ but can’t get this to work. Can someone explain how this is supposed to work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T09:28:28+00:00Added an answer on May 21, 2026 at 9:28 am

    I think you misplace the constraint, it should be like this:

    static mapping = {
        books cascade: "all-delete-orphan"
    }
    

    NOT

    static constraints = {
        books cascade: 'all-delete-orphan'
    }
    

    That causes the problem. More information about this GORM gotchas can be found here(Deleting children).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I get something like this MYSQL query with createCriteria in grails? SELECT
I know this is something of a classic question, but does the mysql/grails (deployed
I have a problem in Grails 1.1.2 + MySQL. My domain class Something contains
Welcome to Grails 1.3.5 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home
I am using grails/groovy, and from my controller I am currently doing this for
How do I increase the maxPoolSize in Grails when using mysql? It appears to
When using Grails 1.1 together with a MySQL the charsets of the auto-generated database
I'm fighting to get the following mapping working in Grails 1.3.1 and MySQL: class
Grails 1.3.7 I get this strange error when I try to invoke my named
I have configured for the MySql database in grails by installing MySql in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.