The JDO Overview covers JDO metadata basics. This chapter discusses the tools Kodo JDO provides to aid in metadata creation, and metadata extensions that Kodo JDO recognizes.
Kodo JDO includes a metadata tool for generating 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.
The metadata tool can be run via the included metadatatool shell/bat script, or through its Java class, kodo.meta.JDOMetaDataTool.
In addition to the standard configuration flags accepted by all Kodo JDO tools, the metadata tool recognizes the following command line flags:
-verbose/-v <true/t | false/f>: The metadata tool honors JDO's extensive system of defaults, so fields that are persistent by default will not be included in the generated XML document. The only exception to this rule is for collection and map fields: the tool adds these fields to the metadata and sets their element-type, key-type, and value-type attributes to Object as a reminder to you to provide this information. If you set this flag to true, however, the tool will generate <field> elements for every persistent field.
-file/-f <metadata file>: The name of the metadata file to generate. If this argument is not supplied, the tool will print the generated metadata to standard output.
Each additional argument to the tool should be the class name, .class file, or .java file of a class to generate metadata for. Each class must be compiled.