I have this domain class
class Client {
  String idCard
  ...
  static constraints = {
    idCard size:16
    ...
  }
}
I created some test data in bootstrap.groovy file
But i get the following error message
Caused by IllegalArgumentException: Parameter for constraint [size] of property [idCard] of class [class ni.sb.Client] must be a of type [groovy.lang.IntRange]
I need this property to be a String and have a fixed length
I am following size constraints documentation with no success
Thanks, for your time
You can use
static constraints = {
    idCard maxSize:16, minSize: 16 // or simply use size: 16..16
    ...
}
This works for Strings and will affect the schema generation VARCHAR(16) (e.g. for MySQL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With