JDO Metadata DTD

Here is the DTD for JDO metadata files, annotated to indicate what's currently supported in TJDO.

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT jdo ((package)+, (extension)*)>

<!ELEMENT package ((class)+, (extension)*)>
<!ATTLIST package name CDATA #REQUIRED>

<!ELEMENT class (field|extension)*>
<!ATTLIST class name CDATA #REQUIRED>
<!ATTLIST class identity-type (application|datastore|nondurable) #IMPLIED>
   Must be "datastore" normally (the default), or "nondurable" for views
<!ATTLIST class objectid-class CDATA #IMPLIED>
   Not supported (only applies to identity-type="application")
<!ATTLIST class requires-extent (true|false) 'true'>
<!ATTLIST class persistence-capable-superclass CDATA #IMPLIED>

<!ELEMENT field ((collection|map|array)?, (extension)*)?>
<!ATTLIST field name CDATA #REQUIRED>
<!ATTLIST field persistence-modifier (persistent|transactional|none) #IMPLIED>
<!ATTLIST field primary-key (true|false) 'false'>
   Not supported (only applies to identity-type="application")
<!ATTLIST field null-value (exception|default|none) 'none'>
   Primitive types default to "exception", all others to "none"
<!ATTLIST field default-fetch-group (true|false) #IMPLIED>
<!ATTLIST field embedded (true|false) #IMPLIED>
   Ignored

<!ELEMENT collection (extension)*>
<!ATTLIST collection element-type CDATA #IMPLIED>
<!ATTLIST collection embedded-element (true|false) #IMPLIED>
   Ignored

<!ELEMENT map (extension)*>
<!ATTLIST map key-type CDATA #IMPLIED>
<!ATTLIST map embedded-key (true|false) #IMPLIED>
   Ignored
<!ATTLIST map value-type CDATA #IMPLIED>
<!ATTLIST map embedded-value (true|false) #IMPLIED>
   Ignored

<!ELEMENT array (extension)*>
<!ATTLIST array embedded-element (true|false) #IMPLIED>
   Ignored

<!ELEMENT extension (extension)*>
   See examples below
<!ATTLIST extension vendor-name CDATA #REQUIRED>
<!ATTLIST extension key CDATA #IMPLIED>
<!ATTLIST extension value CDATA #IMPLIED>

TJDO Metadata Extensions

Database column attributes:

Collection life-cycle (see Collections):

Inverse relationships (see Collections):

Views (see Views):

The "length" extension must be provided for String fields. The length-specification above must be one of:

"n" Fixed-length n characters
"max n" Variable-length n characters maximum
"unlimited" Variable-length no limit

When a String serves as a key or value in a Map field, the alternate extensions "key-length" and/or "value-length" can be used to distinguish which column the length setting applies to.

The "precision" and "scale" extensions only apply to fields of the following types:

Here, precision and scale have their usual SQL meanings, i.e. precision is the maximum total number of decimal digits, and scale is the number of those digits that are to the right of the decimal point. Precision must be provided, but scale is optional (it defaults to zero).

Like "length", there are alternate extensions "key-precision", "key-scale", "value-precision", and "value-scale" to disambiguate the settings if necessary in Map fields.


SourceForge.net