Java Reference
In-Depth Information
the method is the attribute name. The blank constraint implies, naturally enough, that the
name of the product can't be an empty string. The price constraint sets a minimum value
of 0, and the d makes it a double, because the constraint type must match the attribute data
type.
11 The lizard creature that Captain Kirk fought in the Star Trek original series episode “Arena” was a Gorn, not a
GORM. I mean, who ever heard of Grails Object-Relational Napping, anyway? (Though there's probably a “lazy
loading” joke in there somewhere.)
This application will have three more domain classes, representing customers, orders, and
lines on the orders. Next up is the Customer class, shown in the next listing.
Listing 8.11. The Customer class. Customers have many orders (hopefully).
Customers have a name attribute and a Set representing their orders.
Grails hasmany
In Grails the hasMany property implies a one-to-many relationship. By default, the con-
tained objects form a set.
The name cannot be blank. The Order class is shown in the following listing.
 
Search WWH ::




Custom Search