1.11. Custom Mappings
Prev | Chapter 1. Kodo Sample Code | Next

## 1.11. Custom Mappings

The files for this sample are located in the `samples/ormapping` directory of the Kodo installation. This sample demonstrates custom field and class mappings.

- IsMaleMapping is a custom field mapping that transforms a boolean field into 'M' or 'F' characters in the database. If shows how to create simple transformation mappings.

- SQLDateMapping is a custom field mapping for java.sql.Date, which is not supported by JDO. It shows how to create mappings for standard JDBC types that are not covered by the JDO spec.

- XMLMapping is a custom field mapping that simulates a field that maps to a non-standard column type, and that may require non-standard operations to store and retrieve data.

- PointMapping is a custom field mapping for java.awt.Point. It demonstrates how to create a multi-column custom field mapping for complex data.

- StoredProcClassMapping is a custom class mapping that simulates using stored procedures to access persistent data.

The CustomFields class is a persistence-capable class that uses each of the custom field mappings above. The StoredProc class is a persistence-capable class that uses the StoredProcClassMapping. The CustomFieldsMain and StoredProcMain classes are simple driver programs for each of these types.

Note that creating custom class mappings requires a license for the Enterprise Edition. Custom field mappings work with the Standard Edition.

Also, make sure to browse the "externalization" sample directory. Kodo includes an externalization feature that can be used to persist many unsupported field types without having to create a custom field mapping.

Prev | Up | Next
1.10. XDoclet Integration | Home | 1.12. Example of full-text searching in JDO