在grails update中找不到id为null的用户

时间:2014-03-12 04:48:35

标签: spring grails

我的域名类如下..

class User {
    transient springSecurityService
    String username
    String password
    boolean enabled
    boolean accountExpired
    boolean accountLocked
    boolean passwordExpired

    static constraints = {
        username blank: false, unique: true
        password blank: false
    }

    static mapping = {
        id name: 'id'
        password column: '`password`'
    }

    Set<Role> getAuthorities() {
        UserRole.findAllByUser(this).collect { it.role } as Set
    }

    def beforeInsert() {
        encodePassword()
    }

    def beforeUpdate() {
        if (isDirty('password')) {
            encodePassword()
        }
    }

    protected void encodePassword() {
        password = springSecurityService.encodePassword(password)
    }
}

使用spring安全核心插件。我使用了generate-all。但是当我尝试更新时,我发现用户找不到id null错误。我查看了类似的帖子。但它对我没用。

0 个答案:

没有答案