I'm trying to do a straight forward data bind that involved two domain classes in a one to one association. Here's the two classes:
class Request
{
static hasOne = [form: Form]
Form form
}
class Form
{
static belongsTo = [request: Request]
String string
}
I then do the following data binding (this is to demonstrate the problem ... the real data bind comes from a form):
Request request = new Request()
request.properties = ['form.string': 'string value']
However, I end up with a Request object that has a null form property instead of a Request object that has a Form object for its form property along with the string value.
Turns out the problem wasn't with the actual classes, but the map being passed to the data binding. Even though according to the Grails documentation the following should have worked:
it doesn't. However, if I change the map to be I get proper binding: