Turns domain knowledge into code

g9 Concepts

Domain knowledge is important in order to understand and maintain an application. A domain model can capture and maintain this knowledge whether you use agile or more traditional development methods. Throughout the application life cycle, the domain model is often updated requiring code modifications.

Domain models have often been described as a model that incorporates both behavior and data. A domain model describes the objects used in an application and the relationships between them. g9 is based on a model-driven approach to software development.


Important concepts and models in g9:

  • Domain model - Application concept defined as domain/class models in UML or EMF/Xcore Domain models. The models are synchronized into the g9 workspace
  • Database model - Representation of the persistent part of the domain model suitable for database modeling
  • Object selection - Subset of the Domain model containing selected objects and association roles from the domain model
  • Resource and Dialog template - Elements such as colors, fonts and images and template guidelines for user interface design
  • Dialog model - User interface design based on Object selections and Dialog templates

g9 has support for modeling in Enterprise Architect (EA) or Eclipse modeling framework (EMF) Ecore/Xcore. EA is a commercial product requiring a separate license. EMF Ecore/Xcore is an open source project supported by Eclipse.

Read more about:

g9 Models

The strength of g9 lies in its ability to integrate with various business modeling tools that support UML. Users can perform full life-cycle modeling for their various applications using the modeling tool to analyse, design, implement, test and maintain their application. Using g9, the user can import the design model and generate various target applications and databases. As the product evolves, the design model can be re-imported and the application regenerated without affecting any previous tailoring or UI modeling. This approach allows for greater control of the application process through the business model.

Domain model in Enterprise Architect

Enterprise Architect is a comprehensive UML analysis and design tool from Sparx systems. Included with g9 is a g9 UML profile that defines g9 specific elements. The model file (*.eap) can be imported into the g9 project which can then generate the required target application.

For more information about EA: http://www.sparxsystems.com/

Domain model in EMF Ecore/Xcore

The Eclipse Modeling Framework (EMF), an open source project hosted by Eclipse, is a modeling framework for building tools and other applications based on a structured data model.The Ecore format is essentially a sub-set of UML class diagrams that describes object attributes, relationships, operations and constraints and is specified in the Eclipse EMF project. The model file (*.ecore) can be imported into the g9 project which can then generate the required target application.For more information see http://www.eclipse.org/modeling/emf/?project=emf

All plugins and tools that can produce a proper Ecore format, may be used to model g9 artifacts. Within Eclipse is Xcore, a textual representation of Ecore models. Xcore is an extended syntax for Ecore that allows the user to specify not only the model structure, but also the behavior of operations and features as well as conversion logic of data types. See http://wiki.eclipse.org/Xcore

To model g9 artifacts with Xcore, see the g9 Ecore/Xcore annotations chapter in the g9 User Guide.

Domain model in Java

Many projects describe the domain model directly in Java source. g9 can read such class definitions and establish the classes as the domain model for use in further modeling and code generation. You may annotate the classes with JPA and g9 annotations.

Database model

A database model is used to define a a specific database implementation for a target DBMS. The model is generated from the persistent parts of the class model, as defined in the UML model. The model allows for the generation of DBMS schema scripts based on the target DBMS. It also provides for mapping the class objects to the appropriate DB data structures in the run-time application for viewing, modifying, adding and deleting objects. The database model editor provides a tree-based representation of the mapped elements for each target DBMS. This includes columns, groups and procedures.

Object Selection Model

An object is a subset of a class model that specifies those classes that comprise the information model used by a dialog og a service. Normally, there is one object selection for each dialog specified in the UML model. The object selection is used when modeling a dialog, to generate client code and service code that provides CRUD operations for the dialog.

Dialog profile and Dialog model

A dialog template is a collection of properties that default applies to dialogs generated for a specific client target. A dialog model describes the user-interface components used in a specific dialog and is based on an object selection.

The dialog editor provides a tree-based representation as well as a GUI based visualization of the dialog and allows the user to visually modify the dialog.


g9 Code generation

Generating applications

Included with g9 are various code generators that generate the various code components for an application. This includes domain generators for generating Java domain classes and web specific files, service generators for generating the service part of an application, dialog generators for generating the client part of the application, database generators for generating schema scripts and a data access generator that uses Hibernate for accessing data for a supported DBMS.


All built-in generators are described in generator overview.

Dialog generator

It generates the client part(s) of the application. The dialog models and their object selections are used when generating the client code.

Domain generator

The domain generator generates Java code (i.e. Java classes, interfaces and enumerators) based on the domain model. The generators can be configured and the generated code can be extended using hooks. Tailor made code is not overwritten when re-generating code.

Web Service generator

The Web Service generators are used when developing web services and they generate:

  • SOAP/Castor marshalling
  • WS Client
  • WSDL
  • XSD

Object selection generator

The Object Selection generators generate code for the service part of the application. This includes the code for all necessary CRUD actions.

  • CRUD services used in dialogs
  • Generation of SOAP messages used in Web services

Database generator

The database type generators include both the Hibernate generator for mapping the domain model to the DBMS, as well as individual schema generators for the supported databases (Derby, MySQL, Oracle, SQL Server, Sybase and Mimer). Schema generators use the database model specified for the target database.

Create your own generator

g9 supports the creation of user defined generators for generating code into specified target directories. The custom generators support using Xtend for developing generators although generators can be written using Java alone. Xtend is a dialect of Java and is targeted at template programming and text processing. It translates to Java source code but has many improvements and it is fully inter-operable with Java. The Xtend Eclipse plug-in makes it easy to work with Xtend and integrates seamlessly with Java.

Read more about Xtend at http://www.eclipse.org/xtend/


g9 Architecture

The application generated by g9 is a multi-tier application with the following components:

  • A rich client interface with Swing, React or ICEfaces.
  • An object selection CRUD services layer using either POJOs or J2EE stateless session beans.
  • Web Services and JMS support code.
  • Dialog reports with Jasper Reports or spreadsheet export.
  • A POJO domain model.
  • Object relational mapping and persistent storage handling by Hibernate.
  • Any database supported by Hibernate and g9.

g9 runtime architecture


The rich client interface consists of the following runtime components:

  • Java classes for the Domain Model generated from g9 or the domain modeling tool.
  • Java code for each dialog in the application. This is generated from g9, and consists of classes for the view and controller, and also action code for the actions defined for each dialog component in a g9 dialog model. The action code is the glue between the client and the server side actions.
  • Hook code which lets the programmer override the default functionality of the generated code, and also add new functionality.
  • A service proxy which acts as a proxy layer for server side CRUD actions. The default service proxy uses Spring to wire up the server code.

g9 serverside arkitektur


The server side code consists of the following components:

  • The same Java classes for the domain model as on the client.
  • A service interface for the server side CRUD actions. The service interface has two implementations in the runtime library. One is a POJO implementation which runs in the same JVM as the client, the other is based on J2EE stateless session beans. As Spring is used to wire up to the server side code, one can easily change between the POJO and EJB implementation by just editing the Spring configuration file.
  • Service code which supports the server side CRUD actions for all persistent object selection roles for the dialogs.
  • Hook code which lets the programmer override the default functionality of the generated code, and also add new functionality.
  • A persistence interface layer which hides the persistence implementation details for the service and hook code.
  • A persistence implementation. Hibernate is currently the supported implementation.
  • Hibernate Object Relational mapping files are generated from g9, and provides the information which lets Hibernate transport data between the database and the Java domain objects.
  • Database schema files are generated from g9. g9 supports a number of the most popular database systems.


g9 License

g9 runtime


To upgrade g9 to newer versions, a valid license is required.

The g9 licenses is maintained in the Eclipse > Preferences > g9 > License page. It shows information about the current license and may be used to order and install a valid license.

Please contact us by e-mail adm@esito.no to extend your existing license or obtaining a new licence.