Menu

database-re-factoring

Harry Gardner

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:

  1. Design database refactoring (add tables or columns, remove columns, create views**)
  2. Apply changes to the database using a tool such as liquibase. See samples/db in the distribution for working example.
  3. 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.
  4. Generate entity beans (pojos) for tables or views modified by database refactoring:
    codegen.sh -t table1,table2 -v view1,view2 <configFileName>
  5. As needed, modify code that depends on generated entities (i.e. add data, remove call for column removed, etc).
  6. Run tests *
  7. Commit changes to source control - allowing validation of changes in different environments.

  8. 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


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.