as part of an upgrade from 2.4 to Grails 5, I've encountered an oddity where when I attempt to access a particular field in a domain, I get a SQL exception because the back reference _id column is not found.
My model is as such:
class Parent {
Child firstChild
Child secondChild
}
class Child {
static belongsTo = [parent:Parent]
}
My understanding is there will be a parent property added to the Child class, but no back referencing column will be created in the table unless I add a hasOne declaration to the Parent class. Which is what I want, and what used to work. This also works if there is only one Child, but the problem starts when I add the secondChild.
However when I have an instance of a Parent, e.g. Child childInstance and I access the parent property, then it's firing a SQL Syntax exception Unknown column 'parent_id' in 'field list'
Since Grails 2.4 is there something different we need to do to correctly handle this relationship and not require any parent_id in the child table
Thanks.