You are previewing The Definitive Guide to Grails 2.

The Definitive Guide to Grails 2

Cover of The Definitive Guide to Grails 2 by Jeff Scott Brown... Published by Apress
  1. Title
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Chapter 1: The Essence of Grails
    1. Simplicity and Power
    2. Grails, the Platform
    3. Living in the Java Ecosystem
    4. Installing and Configuring Grails
    5. Creating Your First Application
    6. Grails Interactive Mode
    7. Summary
  9. Chapter 2: Getting Started with Grails
    1. What Is Scaffolding?
    2. Creating a Domain
    3. Introducing Dynamic Scaffolding
    4. Static Scaffolding
    5. Being Environmentally Friendly
    6. Configuring Data Sources
    7. Deploying the Application
    8. Summary
  10. Chapter 3: Understanding Domain Classes
    1. Persisting Fields to the Database
    2. Validating Domain Classes
    3. Using Custom Validators
    4. Understanding Transient Properties
    5. Customizing Your Database Mapping
    6. Building Relationships
    7. Extending Classes with Inheritance
    8. Embedding Objects
    9. Testing Domain Classes
    10. Summary
  11. Chapter 4: Understanding Controllers
    1. Defining Controllers
    2. Creating a Model
    3. Rendering a View
    4. Performing Data Binding
    5. Working with Command Objects
    6. Imposing HTTP Method Restrictions
    7. Controller IO
    8. Using Simple Interceptors
    9. Testing Controllers
    10. Controllers in Action
    11. Summary
  12. Chapter 5: Understanding Views
    1. The Basics
    2. Built-in Grails Tags
    3. Grails Dynamic Tags
    4. Summary
  13. Chapter 6: Mapping URLs
    1. Understanding the Default URL Mapping
    2. Including Static Text in a URL Mapping
    3. Removing the Controller and Action Names from the URL
    4. Embedding Parameters in a Mapping
    5. Specifying Additional Parameters
    6. Mapping to a View
    7. Applying Constraints to URL Mappings
    8. Mapping to HTTP Request Methods
    9. Mapping HTTP Response Codes
    10. Taking Advantage of Reverse URL Mapping
    11. Named URL Mappings
    12. Defining Multiple URL Mappings Classes
    13. Testing URL Mappings
    14. Summary
  14. Chapter 7: Internationalization
    1. Localizing Messages
    2. Using Parameterized Messages
    3. Using Parameterized Messages for Validation
    4. Using messageSource
    5. Summary
  15. Chapter 8: Ajax
    1. Writing Ajax Code
    2. Ajax in Action
    3. Changing Your Ajax Provider
    4. Asynchronous Form Submission
    5. Fun with Ajax Remote Linking
    6. Adding Effects and Animation
    7. Ajax-Enabled Form Fields
    8. A Note on Ajax and Performance
    9. Summary
  16. Chapter 9: GORM
    1. Persistence Basics
    2. Associations
    3. Querying
    4. Configuring GORM
    5. The Semantics of GORM
    6. Transactions in GORM
    7. Detached Objects
    8. Performance Tuning GORM
    9. Locking Strategies
    10. Events Auto Time Stamping
    11. Summary
  17. Chapter 10: Services
    1. Understanding Service Basics
    2. Services and Dependency Injection
    3. Services in Action
    4. Managing Transactions
    5. Scoping Services
    6. Testing Services
    7. Exposing Services
    8. Summary
  18. Chapter 11: Integration and Dependency Management
    1. Grails and Configuration
    2. Declaring Dependencies
    3. Understanding the Grails Build System
    4. Continuous Integration with Hudson
    5. Adding Support to Your Favorite IDE
    6. Integration with E-mail Servers
    7. Deployment
    8. Summary
  19. Chapter 12: Plug-ins
    1. Plug-in Basics
    2. Plug-ins in Action
    3. Specifying Plug-in Locations on the File System
    4. Using the Resources Plug-in
    5. Using the Database Migration Plug-in
    6. Summary
  20. Index
O'Reilly logo

CHAPTER 3

Image

Understanding Domain Classes

Object-oriented (OO) applications almost always involve a domain model representing the business entities that the application deals with. The gTunes application will include a number of domain classes, including Artist, Album, and Song. Each of these domain classes has properties associated with it. You must map those properties to a database in order to persist instances of those classes.

Developers of object-oriented applications face some difficult problems in mapping objects to a relational database. This is not because relational databases are especially difficult to work with; the trouble is that ...

The best content for your career. Discover unlimited learning on demand for around $1/day.