Grails hasOne 关系没有 belongsTo
Grails hasOne Relationship without belongsTo
当通过文档处理没有 belongsTo 的 hasOne 关系时,它会抛出错误
hasOne property [Face.nose] is not bidirectional. Specify the other side of the relationship!.
这只是一个例子,在我的用例中,如果我删除鼻子,我不应该删除 face.So 如何在不使用 belongsTo 的情况下使其工作?
class Face {
..
static hasOne = [nose: Nose]
}
class Nose {
Face face
}
我认为你的路径是不使用 hasOne
关键字。
class Face {
Nose nose
}
class Nose {
Face face
}
两者都可以独立存在,但都相互引用。
当通过文档处理没有 belongsTo 的 hasOne 关系时,它会抛出错误
hasOne property [Face.nose] is not bidirectional. Specify the other side of the relationship!.
这只是一个例子,在我的用例中,如果我删除鼻子,我不应该删除 face.So 如何在不使用 belongsTo 的情况下使其工作?
class Face {
..
static hasOne = [nose: Nose]
}
class Nose {
Face face
}
我认为你的路径是不使用 hasOne
关键字。
class Face {
Nose nose
}
class Nose {
Face face
}
两者都可以独立存在,但都相互引用。