I'm developing a website that need categories with sub categories.
My current domain class is:
package com.abc
class Category {
String title
String description
Category parent
static hasMany = [children: Category, listing: Listing]
static constraints = {
title blank: false
description blank: true
}
}
But it gives me an error:
Property [children] in class [class com.abc.Category] is a bidirectional one-to-many with two possible properties on the inverse side. Either name one of the properties on other side of the relationship [category] or use the 'mappedBy' static to define the property that the relationship is mapped with. Example: static mappedBy = [children:'myprop']