Grails - adding custom fields (columns) to all domain objects - automatically

前端 未结 3 338
自闭症患者
自闭症患者 2021-01-22 04:50

By default when you create a domain class, it will automatically add \"id\" and \"version\" column for all the domain classes (tables). What if I want to add a column say for e.

3条回答
  •  孤城傲影
    2021-01-22 05:34

    You could use the meta programming magic that Groovy provides for this sort of thing, however, I would probably just go a more typical route and use inheritance. Create a parent domain that contains isChecked (and anything else you need) and have your domains that require them extend that class.

提交回复
热议问题