To map the class, try something like this:
class Foo {
String title
Foo parent
static mapping = {
parent column: 'parentId'
}
}
You don't need to specify the id
as a Long
because that is the default. You will, however, need to specify the id
if it has a column name other than id
.
As far as the parent object goes, you will need to map it by the foreign key column's name.