Search code examples
grailsgrails-orm

Grails: What classes should be domain classes?


If I have created a domain class in Grails that has a data field of a custom data type, does that data type also need to be a domain class in order to be saved in the database?


Solution

  • Grails understands how to persist strings, numbers, dates, booleans, etc, as well as other domain classes. If you want to persist a type that isn't directly supported you can create a custom Hibernate UserType to tell Hibernate how to store and retrieve your data. See the docs here: http://grails.org/doc/latest/guide/GORM.html#customHibernateTypes