Grails Enum Mapping

Viewed 24779

in Grails, Is there a way to limit the size of the column to which the enum is mapped. In the following example, i would like the column type to be char(2)

enum FooStatus {
    BAR('br'), TAR('tr')
    final static String id
}

class Foo {
    FooStatus status

    static constraints = {
        status(inList:FooStatus.values()*.id,size:2..2)
    }
}

both inList and size do not have any effect when exporting the schema, the column type keeps its default value (varch(255)) Maybe i could do that if i define a new UserType. Any idea ?

Thank you -ken

4 Answers
Related