(Quick Reference)
Domain Class Usage
A domain class fulfills the M in the Model View Controller (MVC) pattern and represents a persistent entity that is mapped onto an underlying database table. In Grails a domain is a class that lives in the
grails-app/domain
directory. A domain class can be created with the
create-domain-class command:
grails create-domain-class org.bookstore.Book
or with your favourite IDE or text editor.
package org.bookstoreclass Book {
String title
Date releaseDate
Author author
}
The class name, by default, is mapped to the table name in lower case and separated by underscores instead of camel case. Each property maps to individual columns.
Refer to the user guide section on
GORM for more information.