I want to persist a List<String> field into a single VARCHAR column using Grails with GORM and Hibernate. I have written a Hibernate custom type but cannot figure out how to get GORM/Hibernate to treat the list field as persistent:
class User {
List<String> listOfStrings
static mapping = {
listOfStrings(type: StringListType, length: 512)
}
}
The 'listOfStrings' mapping is ignored. Any ideas? For now I have worked around the problem using an extra String field and a set/get to encode and decode the List.
@Type(..)
annotation? – Bozho