You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the Grails Spring Security core for the security of the web app. And this working with this dependency very well. But I get an error when the primary key is a domain and not a value. I mean a composite primary key. For example:
In this case (using the domain of the Spring Security) the primary key is a composite value that uses the primary key of the user object and the role object. But in the console, I get the following error:
Seed Error Inserting UserRole (user: null, role: null, id: null, version: null)
- The [role] property of the class [class app.UserRole] can not be null
- The [user] property of class [class app.UserRole] can not be null
The UserRole class is this:
@GrailsCompileStatic
@ToString(cache=true, includeNames=true, includePackage=false)
class UserRole implements Serializable {
private static final long serialVersionUID = 1
User user
Role role
......
static constraints = {
user nullable: false
role nullable: false, validator: { Role r, UserRole ur ->
if (ur.user?.id) {
if (UserRole.exists(ur.user.id, r.id)) {
return ['userRole.exists']
}
}
}
}
static mapping = {
id composite: ['user', 'role']
version false
}
}
The text was updated successfully, but these errors were encountered:
I am using the Grails Spring Security core for the security of the web app. And this working with this dependency very well. But I get an error when the primary key is a domain and not a value. I mean a composite primary key. For example:
In this case (using the domain of the Spring Security) the primary key is a composite value that uses the primary key of the user object and the role object. But in the console, I get the following error:
The UserRole class is this:
The text was updated successfully, but these errors were encountered: