当遍历文档以处理不具有belongsTo的hasOne关系时,它将引发错误
hasOne property [Face.nose] is not bidirectional. Specify the other side of the relationship!.
这只是一个例子,在我的用例中,如果我删除 Nose ,我不应该删除脸部,那么如何在不使用belongsTo的情况下使其工作呢?
class Face {
..
static hasOne = [nose: Nose]
}
class Nose {
Face face
}
最佳答案
我认为您的路径是不使用hasOne
关键字。
class Face {
Nose nose
}
class Nose {
Face face
}
两者可以独立存在,但是两者相互引用。
关于hibernate - Grails具有一个无所属关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50420067/