A domain class can be created with the
create-domain-class command:
grails create-domain-class Person
This will create a class at the location
grails-app/domain/Person.groovy
such as the one below:
If you have the dbCreate
property set to "update", "create" or "create-drop" on your DataSource, Grails will automatically generated/modify the database tables for you.
You can customize the class by adding properties:
class Person {
String name
Integer age
Date lastVisit
}
Once you have a domain class try and manipulate it via the
shell or
console by typing:
This loads an interactive GUI where you can type Groovy commands.