API / Apache Grails Interview questions
What is a Grails domain class?
A domain class is a plain Groovy class placed in an application's grails-app/domain directory, and that location convention alone is what tells Grails to treat it as a persistent entity managed by GORM.
Its properties become database columns automatically: a class with a String title and a Person author field, for example, needs no further annotation or XML mapping for GORM to create a matching table with a foreign key to the Person table. Validation rules, relationships (one-to-many, many-to-many), and mapping overrides are added through optional static blocks — constraints and mapping — directly inside the class, keeping the persistence definition and the validation rules for that entity in one place.
This is convention-over-configuration in its most direct form: a bare Groovy class in the right folder is a fully working, persistable database entity before a single line of explicit ORM configuration is written.
More Related questions...