RevGen Features

Database Mappings

Column Types

Simple column types are mapped using standard JDBC mappings with the following additional rules:

  • Nullable columns will force the use of primitive wrapper classes when applicable.
  • Non-nullable columns will map the Java primitives types when applicable.
  • Single character types with a default of 'Y', 'N', 'T' or 'F' will map to boolean types.

    Type mapping can be custimized by overriding the propertyType(Column column) method of the Db2JavaMapper class.

Primary Keys

Simple, auto-sequencing and compound primary keys are supported.

Foreign Keys-to-Relationships

The most common many-to-one, one-to-many, one-to-one and many-to-many mappings. Currently (1.0-beta2) relationships with single column foreign key to a compound primary key tables in JPA/Hibernate 3.2 is not working - just need a working example to fix.

Relationships are bi-directional by default. Uni-directional relationships must be specified explicitly in the model on a per-relationship basis.

Database fetching modes (ie cascade-delete, etc.) supported by JDBC metadata are translated. Others must be specified explicitly in the model

Relationship naming, cardinality and collection type mapping can be custimized by overriding the applicable method of the Db2JavaMapper class.

Limitations

  • DB relationships are inherently bi-directional, so relationship directionality require additional metadata to restrict.
  • Requires Java 5 at build time.
  • Although the generator emits Java 5 artifacts, older versions can be targeted by turning off annotations and removing generics from the templates.
  • Embedded/composite mappings can't easily be inferred from DB schemas and are not currently supported.
  • Likewise inheritance hierarchies are not easily inferred from DB schemas and are also not currently supported.
  • Most of the 'exotic' or 'not recommended' mappings described in Hibernate and EJB3 books will probably never be supported ;-)
  • Primary key and foreign key constraints are used to determine the primary key properties and relationships respectively. If your database does not support or define these constraints you will have to do additional model processing before invoking the template engine. If you use good column naming conventions, this task can be automated with a naming pattern visitor.

Short-term Limitations

these should be fixed soon ;-)

  • Currently collections are limited to Sets.
  • Versioning is not yet supported.
  • Lists (ie OrderBy) containers are not yet supported.