Reputation: 488
I like to create a domain class with an integer attribute who should be mapped at database with a length of 2, by default GORM creates an INT(11).
Ex:
class MyDomain {
int options
static constraints = {
options(min: 0, max: 99, maxSize: 2)
// options(size: 2) -> Size are not available for integer attribute.
}
static mapping = {
options(length: 2) // Does't work too
}
}
Obs.: I'm using Grails v2.5.2.
Upvotes: 1
Views: 529
Reputation: 578
For Integer attributes you can use sqlType in your mapping :
static mapping = {
options sqlType: 'INT(2)'
}
More info you about mapping you can find here : http://grails.github.io/grails-doc/2.5.1/ref/Database%20Mapping/column.html
Upvotes: 2