Chapter 6. Metadata

6.1. Generating Default JDO Metadata
6.2. JDO Metadata Extensions
6.2.1. Relation Extensions
6.2.1.1. inverse-owner
6.2.1.2. inverse-logical
6.2.1.3. dependent
6.2.1.4. element-dependent
6.2.1.5. value-dependent
6.2.1.6. key-dependent
6.2.1.7. type
6.2.1.8. element-type
6.2.1.9. value-type
6.2.1.10. key-type
6.2.1.11. lrs
6.2.1.12. Example
6.2.2. Schema Extensions
6.2.2.1. jdbc-size
6.2.2.2. jdbc-element-size
6.2.2.3. jdbc-value-size
6.2.2.4. jdbc-key-size
6.2.2.5. jdbc-type
6.2.2.6. jdbc-sql-type
6.2.2.7. jdbc-indexed
6.2.2.8. jdbc-element-indexed
6.2.2.9. jdbc-value-indexed
6.2.2.10. jdbc-key-indexed
6.2.2.11. jdbc-ref-indexed
6.2.2.12. jdbc-version-ind-indexed
6.2.2.13. jdbc-class-ind-indexed
6.2.2.14. jdbc-delete-action
6.2.2.15. jdbc-element-delete-action
6.2.2.16. jdbc-value-delete-action
6.2.2.17. jdbc-key-delete-action
6.2.2.18. jdbc-ref-delete-action
6.2.2.19. Example
6.2.3. Object-Relational Mapping Extensions
6.2.3.1. jdbc-class-map-name
6.2.3.2. jdbc-version-ind-name
6.2.3.3. jdbc-class-ind-name
6.2.3.4. jdbc-field-map-name
6.2.3.5. jdbc-field-mappings
6.2.3.6. jdbc-ordered
6.2.3.7. jdbc-container-meta
6.2.3.8. jdbc-null-ind
6.2.3.9. externalizer
6.2.3.10. factory
6.2.3.11. external-values
6.2.3.12. jdbc-class-ind-value
6.2.3.13. Example
6.2.4. Miscellaneous Extensions
6.2.4.1. detachable
6.2.4.2. detached-objectid-field
6.2.4.3. detached-state-field
6.2.4.4. fetch-group
6.2.4.5. lock-group
6.2.4.6. lock-groups
6.2.4.7. data-cache
6.2.4.8. data-cache-timeout
6.2.4.9. sequence-assigned
6.2.4.10. subclass-fetch-mode
6.2.4.11. eager-fetch-mode
6.2.4.12. jdbc-sequence-factory
6.2.4.13. jdbc-sequence-name
6.2.4.14. jdbc-auto-increment
6.2.4.15. Example

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.

6.1. Generating Default JDO Metadata

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.

Example 6.1. Using the MetaDataTool

metadatatool -f mypackage/package.jdo mypackage/*.java

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.