Skip to end of metadata
Go to start of metadata

Table of Contents


Introduction

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.

Resources

Prerequisites

FLEX_HOME and GRAIL_HOME must be defined as enviroment variable!!


Domain Model

Scaffolding

Grails Project Creation
Plugin installation
Generating domain class model


Let's edit generated domain classes
Company
Customer
Address
Phone


CRUD Company and Customer Generation
Flex compilation
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)

Relations
  • 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).
Constraints
  • 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

1 Comment

  1. The video is impressive, nice work!

    However, I got an error from the grails (v1.1.1) run-app command - a NullPointer: 'Cannot get property 'starksecurity' on null' when trying the above.

    Is there a quick fix?