5.6. The Complete Document
Prev | Chapter 5. Metadata | Next

## 5.6. The Complete Document

That exhausts the metadata document structure. We present the complete metadata document for our sample model below:

Example 5.3. Full Metadata Document

    <?xml version="1.0"?>
    <!-- Note that all persistence-capable classes must be listed, but -->
    <!-- very few fields need to be specified                          -->
    <jdo>
        <package name="org.mag">
            <class name="Magazine" objectid-class="Magazine$MagazineId">
                <field name="isbn" primary-key="true"/>
                <field name="title" primary-key="true"/>
                <field name="articles">
                    <collection element-type="Article" dependent-element="true"/>
                </field>
                <fetch-group name="detail">
                    <field name="publisher" fetch-depth="0"/>
                    <field name="articles" fetch-depth="0"/>
                </fetch-group>
            </class>
            <class name="Article" identity-type="application" detachable="true">
                <field name="id" primary-key="true"/>
                <field name="authors">
                    <map key-type="String" value-type="org.mag.pub.Author"/>
                </field>
                <field name="subtitles">
                    <collection element-type="String"/>
                </field>
            </class>
        </package>
        <package name="org.mag.pub">
            <class name="Company">
                <field name="address" embedded="true"/>
                <field name="subscriptions">
                    <collection element-type="org.mag.subscribe.Subscription"/>
                </field>
                <field name="mags">
                    <collection element-type="org.mag.Magazine"/>
                </field>
            </class>
            <class name="Author">
                <field name="address" embedded="true"/>
            </class>
            <class name="Address" embedded-only="true"/>
        </package>
        <package name="org.mag.subscribe">
            <class name="Contract" identity-type="application">
                <field name="id" primary-key="true"/>
            </class>
            <class name="Subscription" detachable="true">
                <field name="items">
                    <collection element-type="Subscription$LineItem" dependent-element="true"/>
                    <extension vendor-name="kodo" key="lock-group" value="none"/>
                </field>
            </class>
            <class name="LifetimeSubscription"/>
            <class name="TrialSubscription"/>
            <class name="Subscription$LineItem"/>
        </package>
    </jdo>

Prev | Up | Next
5.5. Fetch Group Element | Home | 5.7. Metadata Placement