0
私が持って作成された次のドメインクラスNULL可能制約は、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でのユーザのテーブルをチェックするとき、それはまだ枝、組織や学生NOTを示していますNULL
関連するドメインにhasOne関連付けを維持しました。例
class Organization { ... static hasOne = [user: User] }
のために、私は疑う、hasOneのは、その
私はdbを落として再度実行しましたが、同じ効果はありません – Abdul
'belongsTo'から参照を削除しました。 – injecteer