7.1 Quick Start Guide

A domain class can be created with the create-domain-class command:

  1. grails create-domain-class helloworld.Person
If no package is specified with the create-domain-class script, Grails automatically uses the application name as the package name.

This will create a class at the location grails-app/domain/helloworld/Person.groovy such as the one below:

  1. package helloworld
  2. class Person {
  3. }
If you have the dbCreate property set to "update", "create" or "create-drop" on your DataSource, Grails will automatically generate/modify the database tables for you.

You can customize the class by adding properties:

  1. class Person {
  2. String name
  3. Integer age
  4. Date lastVisit
  5. }

Once you have a domain class try and manipulate it with the shell or console by typing:

  1. grails console

This loads an interactive GUI where you can run Groovy commands with access to the Spring ApplicationContext, GORM, etc.