How to change primary key column in grails?

前端 未结 2 1497
日久生厌
日久生厌 2020-12-11 02:33

I have a domain class having an Integer variable \'code\'. my requirement is to make \'code\', primary key column for that domain and also auto increment and to remove the d

2条回答
  •  我在风中等你
    2020-12-11 03:20

    Domain classes in Grails by default dictate the way they are mapped to the database using sensible defaults. You can customize these with the ORM Mapping DSL.

    Customizes the way the identifier for a domain class is generated with id. See the Grails documentation for id.

    static mapping = {
        id column: 'code', type: 'integer'
    }
    

提交回复
热议问题