0
我有创建以下域类可空约束没有在MySQL表的列中的任何影响
class User implements Serializable {
private static final long serialVersionUID = 1
String username
String password
String mobile
String email
boolean enabled = true
boolean accountExpired
boolean accountLocked
boolean passwordExpired
static belongsTo = [organization : Organization,
branch : Branch,
student : Student]
Set<Role> getAuthorities() {
(UserRole.findAllByUser(this) as List<UserRole>)*.role as Set<Role>
}
static constraints = {
password blank: false, password: true
username blank: false, unique: true
organization nullable: true
branch nullable: true
student nullable: true
email nullable: true
mobile nullable: true
} }
但是,当我检查MySQL的用户表,它显示仍不分支,组织和学生NULL
我在相关域中维护了一个关联。例如
class Organization { ... static hasOne = [user: User] }
我怀疑,是否有hasOne对
我丢弃了数据库并重新运行,仍然没有影响 – Abdul
从'belongsTo'删除了引用 – injecteer