The IBM System i has a wealth of legacy applications that contain data files many of which were designed several decades ago. There are typically several issues with these files:
- They often have cryptic field names that are limited to 4 significant digits
- They often have assigned keys
- Keys are often composite
- They rarely have a version number or timestamp
- Character fields are most always statically sized (no varchar)
These issues cause complexity with Grails because Grails makes the following assumptions:
- The id is generated
- The presence of an zero id or version number is used to predicate an SQL insert
- Hibernate insert/updates to character columns with strings that exceed the column's maximum length generates an exception
This plugin will generate a Grails domain class from a legacy System i table. It has the following features:
- It will attempt to create domain attribute names from column heading or column text, and, if that fails, the original field name is used
- It will generate Grails constraints for maximum integer, big decimal, and character attributes that match the table definition.
- It will generate the GORM DSL appropriate for the assigned key (composite or atomic)
- It will copy over to the Grails project scaffolding that uses the appropriate mechanism to get() or save() the domain. Note that this plugin requires Grails 1.1 and uses the save(insert:true) to predicate insert versus update.
- The custom scaffolding includes view templates that insert the appropriate links (from a custom tag library)
Use the following Grails command to install the plugin:
grails install-plugin
http://grails400utils.googlecode.com/files/grails-systemitools-0.7.zipDetailed notes for installation and use of this plugin are at:
http://code.google.com/p/grails400utils/wiki/GrailsProjectPluginNote that if your iSeries/AS400/Systemi/IBMi tables are defined in SQL DDL (rather than DDS,) then I suggest you try either:
because, if your DDL-generated tables have foreign key references, dbmapper and grag will define the relationships in the generated Domain -- something my generator does not do (because DDS has no syntax to describe foreign key relationships.)
I've use GRAG a number of times and it works quite well.