Chapter 8. Additional Features

8.1. Custom data processing
8.2. Custom data requests

Kodo JDO Enterprise Edition can be extended and customized to match particular business needs. Some commonly requested customizations are available as fully supported add-on features. This chapter documents these features.

8.1. Custom data processing

Sometimes, data must be loaded from non-standard input feeds, such as from XML input or from ResultSets obtained from custom stored procedures. Kodo JDO's CustomResultObjectProvider interface can be used to load arbitrary data into PersistenceCapable objects associated with a particular PersistenceManager.

Documentation of these interfaces, including some code fragments, can be found in the JavaDoc for the com.solarmetric.kodo.runtime.objectprovider package, and the CustomResultSetResultObjectProvider and ColumnAliasResultObjectProvider. Additionally, an example of how to use the CustomResultObjectProvider interface to load externally obtained SQL data is available in the Kodo JDO distribution.

The ColumnAliasResultObjectProvider implementation is useful when loading data via a custom SELECT statement from tables that Kodo JDO is already configured to map to. In this situation, the Kodo JDO metadata contains enough information for Kodo JDO to do all the data loading of the result set without any application-specific code.

When more application-specific result sets must be processed, the CustomResultSetResultObjectProvider abstract class should be extended. The subclass must provide an implementation of the getFieldValues method, which creates a Map of field names to field values, which will then be loaded into a StateManagerImpl by the Kodo JDO framework.