I have the domain classes:
class Child {
static hasMany = [ toys : Toy ]
String name
Set toys
}
class Toy {
static belongsTo = [ owner : Child ]
String name
}
In my JSP I reference a child by:
child = Child.findByName("Joe")
or
child = Child.findById(123)
But when I attempt to access its fields:
child.getToys()
I get the error:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: Child.toys, no session or session was closed
Do I need to manually start the Hibernate session? If so how would I do this?