Chapter 6. Metadata

6.1. Generating Default JDO Metadata
6.2. Metadata Factory
6.3. Additional JPA Metadata
6.4. Metadata Extensions

The JPA and JDO Overview documents cover standard metadata in Chapter 5, Metadata and Chapter 5, Metadata, respectively. This chapter discusses the tools Kodo provides to aid in metadata creation, and metadata extensions that Kodo recognizes.

6.1. Generating Default JDO Metadata

Kodo's mapping tool can generate default JDO metadata for your persistent classes. The tool can only rely on reflection, so it cannot fill in information that is not available from the class definition itself, such as the element type of collections or the primary key fields of a class using application identity. It does, however, provide a good starting point from which to build up your metadata. See Section 7.1, “Forward Mapping” for details on the mapping tool.

Example 6.1. Generating Metadata with the Mapping Tool

This command adds metadata for all classes in the mypackage directory to the mypackage/package.jdo file. If the file does not exist, the mapping tool will create it.

mappingtool -a add -m true -f mypackage/package.jdo mypackage/*.java


Skip navigation bar   Back to Top