I am trying to get a one-to-many relationship working with grails / gorm. I do not understand how to handle an empty list.
Here is my domain class:
class Parent { List children static hasMany = [children: Children] }
Here is my test:
void testEmptyChildren() { def parent = new Parent() assert 0, parent.children.size() }
This does not work with "java.lang.NullPointerException: cannot call the size () method on a null object"
What should I do to process an empty list?
Nate
source share