Structure and Elements of a JDO File

The document structure is defined by the JDO specification and may either be associated with a JDO schema (XSD) or a doctype definition (DTD):

<?xml version="1.0" encoding="UTF-8"?>
<jdo xmlns="http://java.sun.com/xml/ns/jdo/jdo" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdo 
     http://java.sun.com/xml/ns/jdo/jdo_2_0.xsd">
...
</jdo>
-------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN"
  "http://java.sun.com/dtd/jdo_1_0.dtd">
<jdo>
...
</jdo>

Please note: If you work with a JDK 1.4, using a schema declaration may cause problems, because the default parser provided with this JDKs gets not along with schema declarations. In this case you should either use a DTD or another parser.


The JDO file consists of the following basic elements:

The <jdo> Element (required)

This is the root element of the JDO file. It encloses the description of one ore more packages.

The <package> Element (required)

This element includes all classes of a package.

The <class> Element (required)

The class element is used to describe a persistence-capable class. If such an element exists, it means that the named class is persistence-capable. The attributes of this element amongst others specify the object identity of the associated class.

The <field> Element (optional)

The optional field element describes the properties of a particular field. Possible subelements are collection, map and array. In the chapter "Mappings and Relations" you find a lot of samples for the different kinds of how to map fields.

The <extension> Element (optional)

This element specifies JDO vendor extensions. Signsoft intelliBO only considers the Signsoft intelliBO extensions marked with the vendor-name attribute ssibo.

This extensions enable Signsoft intelliBO to manage additional data within the metadata file. The metadata file is still compliant to the JDO specification with these additional Signsoft intelliBO extensions and can be shared with other JDO implementations. Signsoft intelliBO supports extensions for the class elements and for the field elements only.

The key attribute of the extension is used as a key similar to key-value pairs. For all extensions used with Signsoft intelliBO a key is required. The value attribute is optional, but for most key attributes there is an associated value.

There is always a root extension element that encloses all extensions for the specified persistence type. Currently there is only one persistence type- named jdbc - supported by Signsoft intelliBO.

The following sample shows how the extension could be used:

<?xml version="1.0" encoding="UTF-8"?>
<jdo xmlns="http://java.sun.com/xml/ns/jdo/jdo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdo http://java.sun.com/xml/ns/jdo/jdo_2_0.xsd">

  <package name="com.signsoft">
    <class name="Person">
      <extension vendor-name="ssibo" key="jdbc">
        <extension vendor-name="ssibo" key="a key" value="a value"/>
        <extension vendor-name="ssibo" key="a key" value="a value">
            <extension vendor-name="other" key="a key" value="a value">
        </extension>
      </extension>
    </class>
  </package>
</jdo>

Signsoft intelliBO extensions are applied in many parts of this user guide and their usage is described in detail for the particular case.