有没有办法将我自己生成的自动生成的字段添加到域名如id和版本,如果是,请指导我.为我提供URL表单,我可以阅读并了解Grails和Domain特定语言的核心概念.
install-template在应用程序中使用以获取所有默认模板:
grails install-template
Run Code Online (Sandbox Code Playgroud)
之后你就能看到/src/templates(新创造的)
修改DomainClass.groovy下,/src/templates/artifacts如下图所示:
@artifact.package@class @artifact.name@ {
//according to your need
Long myId
Integer myVersion
static constraints = {
}
}
Run Code Online (Sandbox Code Playgroud)
完成!!!!
此后,当使用create-domain-class命令创建域类时,将自动填充这些字段.
| 归档时间: |
|
| 查看次数: |
732 次 |
| 最近记录: |