- Grails Tutorial
- Grails - Home
- Grails - Overview
- Grails - MVC Architecture
- Grails - Creating an Application
- Grails - The Command Line
- Grails - Application Profiles
- Object Relational Mapping (GORM)
- Grails - The Web Layer
- Grails - Groovy Server Pages
- Grails - Web Services
- Grails - Validation
- Grails - Plugins
Grails - Object Relational Mapping (GORM)
Description
The Grails is a full stack open source framework which uses Hibernate framework as well as implements its own Object Relational Mapping (ORM) layer for groovy known as GORM.
GORM is the persistence component of Grails for handling relational databases. The Object Relational Mapping is implemented in Grails called Domain Class.
In this chapter we will see how GORM implements its Object model in the domain class. You can create a domain class by using the following command:
grails create-domain-class Employee
The above command will create a file which looks like:
package first class Employee { }
Let's modify the generated file by adding the properties:
package first class Employee { String Firstname Integer age }
Once done, use the below command in shell or console to load an interactive GUI to run Groovy commands:
grails console
Advertisements