hasOne
Grails で 1 対 1 の関係に使用します。
class MyParent {
static hasOne = [child: MyChild]
}
class MyChild {
static belongsTo = [parent: MyParent]
static mapping = {
table: 'MyChild'
}
}
DB に「MyChild」という名前のテーブルがあるため、次のエラーが発生します。
Invalid object name 'my_child'
Parent
クラスでリレーションのテーブル名を「my_child」ではなく「MyChild」に指定するにはどうすればよいですか?