How to recover from `don't flush the Session after an exception occurs` error?

前端 未结 2 1471
旧巷少年郎
旧巷少年郎 2021-02-04 19:42

I have two classes :

User

class User {
    //relationships. . . .
    static belongsTo = [ company : Company, role : Role ]
    static          


        
2条回答
  •  再見小時候
    2021-02-04 20:12

    If you are using Spring Security Core, the same error occurs if you add the constraint size or you create a custom validator to check if a "password" is equal to a "confirm password". The solution is to use a command object in these cases. This case is solved here.

    In general, this error could happen if some of the fields is null when it should not be null, but it pass the constraint (usually because some error in the code). The database has a not null rule so the the entry won't be created. Grails will show that ugly error then.

提交回复
热议问题