我有一个域类,我在约束闭包中指定字段的顺序:
package com.myapp
class User {
String loginId
String password
Date dateCreated
static hasOne = [profile:Profile]
static hasMany = [posts:Post, tags:Tag, following:User]
static constraints = {
loginId size: 3..20, unique: true
password size: 6..8, validator: { passwd, user ->
passwd != user.loginId
}
tags()
posts()
following()
profile nullable: true
}
}
我希望标记,发布以及按此顺序显示。但是,我得到3个错误:
ERROR org.grails.orm.hibernate.cfg.HibernateMappingBuilder - ORM Mapping Invalid: Specified config option [tags] does not exist for class [com.myapp.User]!
ERROR org.grails.orm.hibernate.cfg.HibernateMappingBuilder - ORM Mapping Invalid: Specified config option [posts] does not exist for class [com.myapp.User]!
ERROR org.grails.orm.hibernate.cfg.HibernateMappingBuilder - ORM Mapping Invalid: Specified config option [following] does not exist for class [com.myapp.User]!
有什么想法吗?
由于
标记