GORM tablePerHierarchy false, foreign key
I have in my models:
class ContestParticipant{
static mapping = {
id generator: "uuid"
tablePerHierarchy false
}
String id
Contest sweepContest
Client client
String email
}
class Winner extends ContestParticipant{
...
}
my question is, why in the table Winner is not creating a FK to 开发者_如何学Cits parent table?!
the same questio: https://stackoverflow.com/questions/3620158/in-grails-setting-tableperhierarchy-false-doesnt-create-a-foreign-key-relations which wasnt answered!
thanks
In the hibernate documentation it says
The three subclass tables have primary key associations to the superclass table so the relational model is actually a one-to-one association
in its example of table per subclass.
I think this means that you wont see a foreign key. You should see the primary key of the ContentParticipant match the primary key of the Winner, for the Winner row in the db.
精彩评论