I followed all of the rules… I did everything they told me to do… It even says that you can do this like normal GORM can…

A real simple structure:

package blah

class Author {
	String name
	static hasMany = [fiction:Book]
        static constraints = {
        }
}



package blah

class Book {
	String title
	static belongsTo = [ author: Author ]

    static constraints = {
    }
}



And from the example I tried…

import blah.*

def fictBook = new Book(title:"IT")
def nonFictBook = new Book(title:"On Writing: A Memoir of the Craft")
def a = new Author(name:"Stephen King").addToFiction(fictBook).save()



And I’m left with…

No signature of method: mongograilsquickstart.Author.addToFiction() is applicable for argument types: (mongograilsquickstart.Book)



This seems to just not work… Hit me up if you made this work, otherwise I’m gonna push a bug… dan@rhcedan.com


2 Responses to “Grails + MongoDB GORM Plugin + One to Many == FAIL”

  1. It’s not addToFiction(), but addToFictions() (with an ‘s’)

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2013 Dan's Blog Suffusion theme by Sayontan Sinha