开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜