Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Child {
- static hasMany = [ toys : Toy ]
- String name
- Set toys
- }
- class Toy {
- static belongsTo = [ owner : Child ]
- String name
- }
- child = Child.findByName("Joe")
- child = Child.findById(123)
- child.getToys()
- org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: Child.toys, no session or session was closed
- child = Child.findByName("Joe", [ fetch: [ toys: 'eager' ] ] )
Add Comment
Please, Sign In to add comment