I have two classes :
User
class User {
//relationships. . . .
static belongsTo = [ company : Company, role : Role ]
static
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.