Friday, July 13, 2012

working generated updatable code with MP 4 Openxava


In this article the user will learn how to keep Openxava modified-generated code based on Minuteproject 4 updatable code.


Minuteproject offers generated code for Openxava technology.
We will generate one project.
Make a build to get:
  • a working OX Defaulting app
  • a OX workspace
Alter the code
Generate again and ensure that your modification are kept.

MP 4 OX updatable code

Minuteproject provides for updatable code fonctionalities.
When you generate for Openxava, you have to specify that the generated code goes into the OX workspace.
This is because the MP 4 OX is a two-step process.
  • The first you generate the OX code.
  • The second, when you execute build-.cmd/sh, you:
    • build the OX workspace and copy the generated code
    • compile, package, deploy

The code that you modify is the code of the workspace so it generated code should point to the workspace.

If you choose another directory for generation, the process will work fine the first time and all the time you working with reverse-engineering only. But if you alter your code, then when you make the second operation then your modification are erased.

When the generation points to the workspace then only once the two-step process is needed. The second step initiates the project into the workspace.
Once done, no need to run the second step again.
You can alter both your generated code (as described here)
You can also alter your DB model and generate again, your modifications are generation-safe.


Under construction
This example show how to add business rules with ABL and JSR303 into the Minuteproject generated code for OX.
It use Minuteproject 0.8.2 and Openxava 4.5

Add sample config


Build workspace

Alter code

Alter model