我的模型中有:
class ContestParticipant{
static mapping = {
id generator: "uuid"
tablePerHierarchy false
}
String id
Contest sweepContest
Client client
String email
}
class Winner extends ContestParticipant{
...
}
我的问题是,为什么在表 Winner 中没有为其父表创建 FK?!
谢谢
最佳答案
在 hibernate 文档中它说
The three subclass tables have primary key associations to the superclass table so the relational model is actually a one-to-one association
在每个子类的表示例中。
我认为这意味着您不会看到外键。对于数据库中的 Winner 行,您应该看到 ContentParticipant 的主键与 Winner 的主键匹配。
关于mysql - GORM tablePerHierarchy false,外键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6129077/