Over a million developers have joined DZone.

OpenXava 4.5: The Improved Groovy Without Grails

DZone's Guide to

OpenXava 4.5: The Improved Groovy Without Grails

· ·
Free Resource
OpenXava is a framework for Rapid Web Development , well-suited for business- and database-oriented applications.
OpenXava lets you develop applications just by writing simple domain classes with Java or Groovy. The user interface is generated automatically in runtime, without code generation.
The main differences with Grails are:

  • it does not use code generation— you write less code for the first version of your app, but you also have to manage less code for all application lifecycles.
  • it's based in Java standards— it uses JPA, Portlets, Dependency Injection, Bean Validation and other Java standards, so you can move your code to other frameworks in any moment. 
  • the application generated by default by OpenXava is richer than the one generated by Grails— An OpenXava application is ready for production from the first time.

OpenXava 4.5 has some new interesting features such as:

  • offering support for all strategies of JPA inheritance mapping.
  • generating data for list and collections is obtained via JPA, before JDBC was used.
  • using an Automated Business Logic (ABL) library.
  • providing an all-new layout architecture (the code that paints the UI). It's still in BETA but can be activated with layout.painter in xava.properties.


You'll find many other useful new features and bug fixes with this.


Support for all strategies of JPA inheritance mapping

This feature has been demanded for a long time by the community. Until now, only a single-table-per-class-hierarchy mapping strategy was supported (where all of the class's hierarchy's are stored in the same table). Since OpenXava 4.5 you can also use joined- and table-per-class mapping strategies.
That is, you can write some classes in this way:
class Computer extends Identifiable {
  String name

class Tablet extends Computer {
  int screenSize
In this case, you have a table for Computer with ID and NAME columns and a table for Tablet with ID and SCREENSIZE columns. JPA will do a JOIN of the two tables when needed.
Also you can write:
class Shop extends Identifiable {
  String name

class InternetShop extends Shop {
  String url
In this case, you have a table for Shop with an ID and NAME column and another for InternetShop with ID, NAME and URL columns.
From now on, OpenXava will generate a correct user interface for the above classes.

Data for list and collections is obtained via JPA

Until now OpenXava has used JDBC to get the data for lists and collections. It was this way for historical reasons, especially because the very first version of OpenXava used EJB 1.0 CMP entities for persistence and EJB CMP is too slow and rigid to implement the OpenXava list behavior. So we used JDBC. But now, JPA is rapid and flexible enough to be used for obtaining the list data. Therefore, we've written a new JPATabProvider to read the data of the list, and it is the one used by default. This allows us to support all the inheritance JPA types, but also opens many interesting possibilities for the future, such as using DataNucleus instead of Hibernate as JPA engine to access to non-relational databases.

Automated Business Logic (ABL) library added

The folks from the California startup Automated Business Logic have been working hard to integrate their library, ABL, in OpenXava. ABL allows you to define business logic declaratively using annotations. The wiki explains how to use ABL from OpenXava .


All new layout architecture (the code that paints the UI)

The people from SicFlex , a Dominican company that has developed a complete ERP with OpenXava, have developed a new render engine for OpenXava. This is the more important and complicated part of OpenXava. This new render engine will generate even more complex and beautiful user interfaces for OpenXava applications. It is still in beta and it's disabled by default, but you can activate it with the next entries in xava.properties :

# Layout parser calculate and prepare properties to be renderer.
# This is optional, by default OX uses org.openxava.render.DefaultLayoutParser

# Layout painter, render all properties in cell forms
# If a valid painter is defined here, view rendering is performed by it.

And more

See changelog for the complete list of new features and fixes.

Download OpenXava 4.5 and try it


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}