Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do.
-- Steve Jobs

Thursday, July 7, 2011

java - grails one-to-many relationship - Stack Overflow

java - grails one-to-many relationship - Stack Overflow

For testing purpose you can load some data into the bootstrap:

class BootStrap {
def init
= { servletContext ->
def writer
= new Author(name:"Jane")
writer
.save()
if(writer.hasErrors()){
println writer
.errors
}
def comic
= new Book(name: "superman", Author: writer)
comic
.save()
if(comic.hasErrors()){
println comic
.errors
}
}
def destroy
= {}
}

This way your app will have an Author and a Book in it.

Also this tutorial helped me very much.

No comments:

Post a Comment