Java Reference
In-Depth Information
Figure 7-18. Test report: failed test
Creating a Domain Class
At this point, the application we created doesn't really do anything; it just renders a simple textual
response. We will move on by creating a domain class. To create a domain class, use the Grails
create-domain-class target. This creates a new Grails domain class in the grails-app/domain
directory, as well as a unit test for the domain class in test/unit .
To create the Book domain class, you need to execute the create-domain-class target using an
optional class name, as shown here:
> grails createdomain-class book
If you don't supply the class name, you are prompted for one.
Notice that when running the create-domain-class target with the optional class name, you can
leave the class name in lowercase, and Grails will automatically uppercase it for you so that it follows
the standard Groovy class naming convention.
To create the domain class using GGTS, click “domain” in the project hierarchy and then use
New ➤ Domain Class, as illustrated in Figure 7-19 .
 
Search WWH ::




Custom Search