Grails- Unique constraint
- by WaZ
How can I basically carry out a unique constraint on a string data-type field.
class User{
String username
String Email
static hasMany = [roles:Roles]
static constraints = {
Email(email:true)
username(unique:true)
}
Is there any simple way to implement username(unique:true)
or
I will have to manually check the database by the in-built methods like .findByNameLike.
My need is that username should be unique and should be case insensitive