Table of Contents
- Domain Model
- Success tips (Important information)
- Import into Eclipse
In order to explain how this plugin works we are going to write some code for a dummy example app which contains three type of relations (one-to-many, many-to-one and one-to-one) between four domain classes.
Grails Project Creation
Generating domain class model
Let's edit generated domain classes
CRUD Company and Customer Generation
It's time to start up our app-server and navigate our application
open browser and go to http://localhost:8080/gfs-test
Success tips (Important information)
- many-to-one supports only inPlace:false (this declaration is not required because it's setted as a default)
- one-to-many both cases are supported inPlace:false/inPlace:true.
- one-to-one supports only inPlace:true (this declaration is not required because it's setted as a default).
- If relations are declared as inPlace:true, e.g: Customer <-> Address o Customer -> Phone, the included class (Address, Phone) must define the constraint diplay:false for property that is including "custormer(display:false)". At this moment, this restriction is not valid in generation code time and ends by abort process
- Relations must ever be lazy:false if not, BlazeDS throws a LazyInitialization exception (in future versions we are going to support this feature with DPHibernate or similar).
- Front-End supported constraints
- blank, email, size, minSize, maxSize, min, max, range, url, inList
- For each Front-End constraint, a Flex validator is generated. This avoids user to persist the entity without the need of Back-End validation.
- All other constraints (Grails constraints) follows Grails validation way, doing validation on Back-End side which have the responsibility of getting feedback about errors to Front-End. This kind of errors are supported by i18n.
Import into Eclipse
If you want to know how to import a project into FlexBuilder see: How-To import project into eclipse