Grails/GORM saves in the wrong order
I am using Grails 1.3.6 and I am having problems getting saves to cascade properly.  The problem is specifically with classes that have two parent classes.  A simplified version of what I am attempting is this:

    class Location {
    	String city
    	static hasMany = [authors: Author, publishers: Publisher]
    }
    
    class Author {
    	String name
    	static belongsTo = [location: Location]
    	static hasMany = [books: Book]
    }
    
    class Publisher {
    	String name
    	static belongsTo = [location: Location]
    	static hasMany = [books: Book]
    }
    
    class Book {
    	String title
    	static belongsTo = [author: Author, publisher: Publisher]
    }
    
    class Srv1Service {
    
        static transactional = true
    
        def loadData() {
    		def l1 = new Location(city: "London")
    
    		def a1 = new Author(name: "Graham Greene")
    		l1.addToAuthors(a1)
    		
    		def p1 = new Publisher(name: "Some Press")
    		l1.addToPublishers(p1)
    
    		def b1 = new Book(title: "The Comedians")
    		a1.addToBooks(b1)
    		p1.addToBooks(b1)
    
    		l1.save()
        } 
    }

If I run the above loadData, the Book instance is saved before the Publisher instance, resulting in the error "not-null property references a null or transient value: adhoc.Book.publisher".

I have tried various different ways of defining the relationships with little success.  I have tried interim saves, and this does work, but I can see that parent tables are updated as I save the child data - ie Location, Author and Publisher all get updated to version 1.  (And also I would like to keep the code as simple as I can.)  I would like to avoid linking tables.

Any advice is gratefully received!
Grails/GORM saves in the wrong order
===

I am using Grails 1.3.6 and I am having problems getting saves to cascade properly.  The problem is specifically with classes that have two parent classes.  A simplified version of what I am attempting is this:

    class Location {
    	String city
    	static hasMany = [authors: Author, publishers: Publisher]
    }
    
    class Author {
    	String name
    	static belongsTo = [location: Location]
    	static hasMany = [books: Book]
    }
    
    class Publisher {
    	String name
    	static belongsTo = [location: Location]
    	static hasMany = [books: Book]
    }
    
    class Book {
    	String title
    	static belongsTo = [author: Author, publisher: Publisher]
    }
    
    class Srv1Service {
    
        static transactional = true
    
        def loadData() {
    		def l1 = new Location(city: "London")
    
    		def a1 = new Author(name: "Graham Greene")
    		l1.addToAuthors(a1)
    		
    		def p1 = new Publisher(name: "Some Press")
    		l1.addToPublishers(p1)
    
    		def b1 = new Book(title: "The Comedians")
    		a1.addToBooks(b1)
    		p1.addToBooks(b1)
    
    		l1.save()
        } 
    }

If I run the above loadData, the Book instance is saved before the Publisher instance, resulting in the error "not-null property references a null or transient value: adhoc.Book.publisher".

I have tried various different ways of defining the relationships with little success.  I have tried interim saves, and this does work, but I can see that parent tables are updated as I save the child data - ie Location, Author and Publisher all get updated to version 1.  (And also I would like to keep the code as simple as I can.)  I would like to avoid linking tables.

Any advice is gratefully received!