开发者

GORM tablePerHierarchy false, foreign key

开发者 https://www.devze.com 2023-03-08 04:22 出处:网络
I have in my models: class ContestParticipant{ static mapping = { id generator: \"uuid\" tablePerHierarchy false

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

精彩评论

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