Here is an alternative solution
class Person { String firstName String lastName enum Gender { M(1), F(2), U(3) private Gender(int val) { this.id = val } final int id } Gender gender = Gender.U Date dateOfBirth def constraints = { gender() } }
This will store the gender in the database as an integer (1,2,3) and the default gender for U. The advantage here is that you can rename what F, M and U mean without processing data migration.
source share