The DAL4j round trip code generation capability allows database modifications to be applied to your code by re-running code generation. This capability can save hours by minimize hand coding to boiler plate entity beans. The process is described as follows:
- Design database refactoring (add tables or columns, remove columns, create views**)
- Apply changes to the database using a tool such as liquibase. See samples/db in the distribution for working example.
- Optionally, add customizations (relationships or class, attribute or method annotations, etc) to DAL4j configuration. This will allow generated entities to be customized across code generations cycles.
- Generate entity beans (pojos) for tables or views modified by database refactoring:
codegen.sh -t table1,table2 -v view1,view2 <configFileName>
- As needed, modify code that depends on generated entities (i.e. add data, remove call for column removed, etc).
- Run tests *
-
Commit changes to source control - allowing validation of changes in different environments.
-
Coming soon - Entity Unit Tests! Improve code coverage percentages for free!
** When adding new views, the view must be added to dal4j configuration. See samples/simple