alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (hibernate-mapping-4.0.xsd)

This example Hibernate source code file (hibernate-mapping-4.0.xsd) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

a, a, composite, declares, declares, hibernate, java, or, or, see, the, the, this, varchar

The Hibernate hibernate-mapping-4.0.xsd source code

<?xml version="1.0" encoding="UTF-8"?>

<!-- Hibernate Mapping DTD.

An instance of this XML document may contain mappings for an arbitrary 
number of classes. The class mappings may contain associations to classes
mapped in the same document or in another document. No class may be 
mapped more than once. Each document may also contain definitions of an
arbitrary number of queries, and import declarations of arbitrary classes. 

-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
           targetNamespace="http://www.hibernate.org/xsd/hibernate-mapping"
           elementFormDefault="qualified"
           version="4.0">

  <!--
  	The document root.
   -->
  <xs:element name="hibernate-mapping">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
        <!--
            <identifier-generator.../> allows customized short-naming of IdentifierGenerator implementations.
        -->
        <xs:element name="identifier-generator" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:attribute name="class" use="required" type="xs:string"/>
            <xs:attribute name="name" use="required" type="xs:string"/>
          </xs:complexType>
        </xs:element>
        <!--
        	<typedef.../> allows defining a customized type mapping for a Hibernate type. May
        	contain parameters for parameterizable types.
        -->
        <xs:element name="typedef" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="param-element"/>
            </xs:sequence>
            <xs:attribute name="class" use="required" type="xs:string"/>
            <xs:attribute name="name" use="required" type="xs:string"/>
          </xs:complexType>
        </xs:element>
        <!--
        	FILTER-DEF element; top-level filter definition.
        -->
        <xs:element name="filter-def" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType mixed="true">
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
              <!--
              	FILTER-PARAM element; qualifies parameters found within a FILTER-DEF
              	condition.
              -->
              <xs:element name="filter-param">
                <xs:complexType>
                  <xs:attribute name="name" use="required" type="xs:string"/> 
                  <xs:attribute name="type" use="required" type="xs:string"/> 
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="condition" type="xs:string"/>
            <xs:attribute name="name" use="required" type="xs:string"/> 
          </xs:complexType>
        </xs:element>
        <!--
        	IMPORT element definition; an explicit query language "import"
        -->
        <xs:element name="import" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:attribute name="class" use="required" type="xs:string"/>
            <xs:attribute name="rename" type="xs:string"/> 
          </xs:complexType>
        </xs:element>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <!--
          	Root entity mapping.  Poorly named as entities do not have to be represented by 
          	classes at all.  Mapped entities may be represented via different methodologies 
          	(POJO, Map, Dom4j).
          -->
          <xs:element name="class">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
                <xs:element name="subselect" minOccurs="0" type="xs:string"/>
                <xs:element name="cache" minOccurs="0" type="cache-element"/>
                <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
                <!-- The comment element allows definition of a database table or column comment. -->
                <xs:element name="comment" minOccurs="0" type="xs:string"/>
                <xs:element name="tuplizer" minOccurs="0" maxOccurs="unbounded" type="tuplizer-element"/>
                <xs:choice>
                  <!-- Declares the id type, column and generation algorithm for an entity class.
                  If a name attribut is given, the id is exposed to the application through the 
                  named property of the class. If not, the id is only exposed to the application 
                  via Session.getIdentifier() -->
                  <xs:element name="id">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
                        <xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
                        <xs:element name="type" minOccurs="0" type="type-element"/>
                        <xs:element name="generator" minOccurs="0" type="generator-element"/>
                      </xs:sequence>
                      <xs:attribute name="access" type="xs:string"/>
                      <xs:attribute name="column" type="xs:string"/>
                      <xs:attribute name="length" type="xs:string"/>
                      <xs:attribute name="name" type="xs:string"/>
                      <xs:attribute name="node" type="xs:string"/>
                      <xs:attribute name="type" type="xs:string"/>
                      <xs:attribute name="unsaved-value" type="xs:string"/> 
                    </xs:complexType>
                  </xs:element>
                  <!-- A composite key may be modelled by a java class with a property for each 
                  key column. The class must implement java.io.Serializable and reimplement equals() 
                  and hashCode(). -->
                  <xs:element name="composite-id">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
                        <xs:choice maxOccurs="unbounded">
                          <xs:element name="key-property" type="key-property-element"/>
                          <xs:element name="key-many-to-one" type="key-many-to-one-element"/>
                        </xs:choice>
                        <xs:element name="generator" minOccurs="0" type="generator-element"/>
                      </xs:sequence>
                      <xs:attribute name="access" type="xs:string"/>
                      <xs:attribute name="class" type="xs:string"/>
                      <xs:attribute name="mapped" default="false" type="xs:boolean"/>
                      <xs:attribute name="name" type="xs:string"/>
                      <xs:attribute name="node" type="xs:string"/>
                      <xs:attribute name="unsaved-value" default="undefined">
                        <xs:simpleType>
                          <xs:restriction base="xs:token">
                            <xs:enumeration value="any"/>
                            <xs:enumeration value="none"/>
                            <xs:enumeration value="undefined"/>
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:choice>
                <!-- Polymorphic data requires a column holding a class discriminator value. This
                value is not directly exposed to the application. -->
                <xs:element name="discriminator" minOccurs="0">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:choice minOccurs="0">
                        <xs:element name="column" type="column-element"/>
                        <!-- The formula and subselect elements allow us to map derived properties and 
                        entities. -->
                        <xs:element name="formula" type="xs:string"/>
                      </xs:choice>
                    </xs:sequence>
                    <xs:attribute name="column" type="xs:string"/> 
                    <xs:attribute name="force" default="false" type="xs:boolean"/>
                    <xs:attribute name="formula" type="xs:string"/>
                    <xs:attribute name="insert" default="true" type="xs:boolean"/>
                    <xs:attribute name="length" type="xs:string"/>
                    <xs:attribute name="not-null" default="true" type="xs:boolean"/>
                    <xs:attribute name="type" default="string" type="xs:string"/>
                  </xs:complexType>
                </xs:element>
                <!-- A natural-id element allows declaration of the unique business key -->
                <xs:element name="natural-id" minOccurs="0">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:choice minOccurs="0" maxOccurs="unbounded">
                        <xs:element name="property" type="property-element"/>
                        <xs:element name="many-to-one" type="many-to-one-element"/>
                        <xs:element name="component" type="component-element"/>
                        <xs:element name="dynamic-component" type="dynamic-component-element"/>
                        <xs:element name="any" type="any-element"/>
                      </xs:choice>
                    </xs:sequence>
                    <xs:attribute name="mutable" default="false" type="xs:boolean"/>
                  </xs:complexType>
                </xs:element>
                <xs:choice minOccurs="0">
                  <!-- Versioned data requires a column holding a version number. This is exposed to the
                  application through a property of the Java class. -->
                  <xs:element name="version">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
                        <xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
                      </xs:sequence>
                      <xs:attribute name="access" type="xs:string"/>
                      <xs:attribute name="column" type="xs:string"/>
                      <xs:attribute name="generated" default="never" type="generated-attribute"/>
                      <xs:attribute name="insert" type="xs:boolean"/>
                      <xs:attribute name="name" use="required" type="xs:string"/>
                      <xs:attribute name="node" type="xs:string"/>
                      <xs:attribute name="type" default="integer" type="xs:string"/>
                      <xs:attribute name="unsaved-value" default="undefined">
                        <xs:simpleType>
                          <xs:restriction base="xs:token">
                            <xs:enumeration value="negative"/>
                            <xs:enumeration value="null"/>
                            <xs:enumeration value="undefined"/>
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="timestamp">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
                      </xs:sequence>
                      <xs:attribute name="access" type="xs:string"/>
                      <xs:attribute name="column" type="xs:string"/>
                      <xs:attribute name="generated" default="never" type="generated-attribute"/>
                      <xs:attribute name="name" use="required" type="xs:string"/>
                      <xs:attribute name="node" type="xs:string"/>
                      <xs:attribute name="source" default="vm">
                        <xs:simpleType>
                          <xs:restriction base="xs:token">
                            <xs:enumeration value="db"/>
                            <xs:enumeration value="vm"/>
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:attribute>
                      <xs:attribute name="unsaved-value" default="null">
                        <xs:simpleType>
                          <xs:restriction base="xs:token">
                            <xs:enumeration value="null"/>
                            <xs:enumeration value="undefined"/>
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:attribute>
                    </xs:complexType>
                  </xs:element>
                </xs:choice>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                  <xs:element name="property" type="property-element"/>
                  <xs:element name="many-to-one" type="many-to-one-element"/>
                  <xs:element name="one-to-one" type="one-to-one-element"/>
                  <xs:element name="component" type="component-element"/>
                  <xs:element name="dynamic-component" type="dynamic-component-element"/>
                  <xs:element name="properties" type="properties-element"/>
                  <xs:element name="any" type="any-element"/>
                  <xs:element name="map" type="map-element"/>
                  <xs:element name="set" type="set-element"/>
                  <xs:element name="list" type="list-element"/>
                  <xs:element name="bag" type="bag-element"/>
                  <xs:element name="idbag" type="idbag-element"/>
                  <xs:element name="array" type="array-element"/>
                  <xs:element name="primitive-array" type="primitive-array-element"/>
                </xs:choice>
                <xs:choice>
                  <xs:sequence>
                    <xs:element name="join" minOccurs="0" maxOccurs="unbounded" type="join-element"/>
                    <xs:element name="subclass" minOccurs="0" maxOccurs="unbounded" type="subclass-element"/>
                  </xs:sequence>
                  <xs:element name="joined-subclass" minOccurs="0" maxOccurs="unbounded" type="joined-subclass-element"/>
                  <xs:element name="union-subclass" minOccurs="0" maxOccurs="unbounded" type="union-subclass-element"/>
                </xs:choice>
                <xs:element name="loader" minOccurs="0" type="loader-element"/>
                <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
                <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
                <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
                <xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
                <xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
                <xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                  <xs:element name="query" type="query-element"/>
                  <xs:element name="sql-query" type="sql-query-element"/>
                </xs:choice>
              </xs:sequence>
              <xs:attribute name="abstract" type="xs:boolean"/>
              <xs:attribute name="batch-size" type="xs:string"/>
              <xs:attribute name="catalog" type="xs:string"/> 
              <xs:attribute name="check" type="xs:string"/> 
              <xs:attribute name="discriminator-value" type="xs:string"/> 
              <xs:attribute name="dynamic-insert" default="false" type="xs:boolean"/>
              <xs:attribute name="dynamic-update" default="false" type="xs:boolean"/>
              <xs:attribute name="entity-name" type="xs:string"/>
              <xs:attribute name="lazy" type="xs:boolean"/>
              <xs:attribute name="mutable" default="true" type="xs:boolean"/>
              <xs:attribute name="name" type="xs:string"/> 
              <xs:attribute name="node" type="xs:string"/>
              <xs:attribute name="optimistic-lock" default="version">
                <xs:simpleType>
                  <xs:restriction base="xs:token">
                    <xs:enumeration value="all"/>
                    <xs:enumeration value="dirty"/>
                    <xs:enumeration value="none"/>
                    <xs:enumeration value="version"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:attribute>
              <xs:attribute name="persister" type="xs:string"/>
              <xs:attribute name="polymorphism" default="implicit">
                <xs:simpleType>
                  <xs:restriction base="xs:token">
                    <xs:enumeration value="explicit"/>
                    <xs:enumeration value="implicit"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:attribute>
              <xs:attribute name="proxy" type="xs:string"/> 
              <xs:attribute name="rowid" type="xs:string"/>
              <xs:attribute name="schema" type="xs:string"/> 
              <xs:attribute name="select-before-update" default="false" type="xs:boolean"/>
              <xs:attribute name="subselect" type="xs:string"/>
              <xs:attribute name="table" type="xs:string"/> 
              <xs:attribute name="where" type="xs:string"/> 
            </xs:complexType>
          </xs:element>
          <xs:element name="subclass" type="subclass-element"/>
          <xs:element name="joined-subclass" type="joined-subclass-element"/>
          <xs:element name="union-subclass" type="union-subclass-element"/>
        </xs:choice>
        <xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="query" type="query-element"/>
          <xs:element name="sql-query" type="sql-query-element"/>
        </xs:choice>
        <xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
        <!--
            Element for defining "auxiliary" database objects.  Must be one of two forms:
            #1 :
                <database-object>
                    <definition class="CustomClassExtendingAuxiliaryObject"/>
                </database-object>
            #2 :
                <database-object>
                    <create>CREATE OR REPLACE ....
                    <drop>DROP ....
                </database-object>
        -->
        <xs:element name="database-object" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:choice>
                <xs:element name="definition">
                  <xs:complexType>
                    <xs:attribute name="class" use="required" type="xs:string"/>
                  </xs:complexType>
                </xs:element>
                <xs:sequence>
                  <xs:element name="create" type="xs:string"/>
                  <xs:element name="drop" type="xs:string"/>
                </xs:sequence>
              </xs:choice>
              <!--
                  dialect-scope element allows scoping auxiliary-objects to a particular
                  Hibernate dialect implementation.
              -->
              <xs:element name="dialect-scope" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType mixed="true">
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="name" use="required" type="xs:string"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="auto-import" default="true" type="xs:boolean"/>
      <xs:attribute name="catalog" type="xs:string"/> 
      <xs:attribute name="default-access" default="property" type="xs:string"/>
      <xs:attribute name="default-cascade" default="none" type="xs:string"/>
      <xs:attribute name="default-lazy" default="true" type="xs:boolean"/>
      <xs:attribute name="package" type="xs:string"/> 
      <xs:attribute name="schema" type="xs:string"/> 
    </xs:complexType>
  </xs:element>

  <!-- An "any" association is a polymorphic association to any table with
  the given identifier type. The first listed column is a VARCHAR column 
  holding the name of the class (for that row). -->
  <xs:complexType name="any-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="meta-value" minOccurs="0" maxOccurs="unbounded" type="meta-value-element"/>
      <xs:element name="column" type="column-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="id-type" use="required" type="xs:string"/>
    <xs:attribute name="index" type="xs:string"/> 
    <xs:attribute name="insert" default="true" type="xs:boolean"/>
    <xs:attribute name="lazy" default="false" type="xs:boolean"/>
    <xs:attribute name="meta-type" type="xs:string"/> 
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="update" default="true" type="xs:boolean"/>
  </xs:complexType>

  <xs:complexType name="array-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="cache" minOccurs="0" type="cache-element"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="key" type="key-element"/>
      <xs:choice>
        <xs:element name="index" type="index-element"/>
        <xs:element name="list-index" type="list-index-element"/>
      </xs:choice>
      <xs:choice>
        <xs:element name="element" type="element-element"/>
        <xs:element name="one-to-many" type="one-to-many-element"/>
        <xs:element name="many-to-many" type="many-to-many-element"/>
        <xs:element name="composite-element" type="composite-element-element"/>
        <xs:element name="many-to-any" type="many-to-any-element"/>
      </xs:choice>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="sql-delete-all" minOccurs="0" type="sql-delete-all-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/> 
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="collection-type" type="xs:string"/>
    <xs:attribute name="element-class" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
    <xs:attribute name="inverse" default="false" type="xs:boolean"/>
    <xs:attribute name="mutable" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="schema" type="xs:string"/> 
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
    <xs:attribute name="where" type="xs:string"/> 
  </xs:complexType>

  <xs:complexType name="bag-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="cache" minOccurs="0" type="cache-element"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="key" type="key-element"/>
      <xs:choice>
        <xs:element name="element" type="element-element"/>
        <xs:element name="one-to-many" type="one-to-many-element"/>
        <xs:element name="many-to-many" type="many-to-many-element"/>
        <xs:element name="composite-element" type="composite-element-element"/>
        <xs:element name="many-to-any" type="many-to-any-element"/>
      </xs:choice>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="sql-delete-all" minOccurs="0" type="sql-delete-all-element"/>
      <xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/> 
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="collection-type" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
    <xs:attribute name="inverse" default="false" type="xs:boolean"/>
    <xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
    <xs:attribute name="mutable" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="order-by" type="xs:string"/> 
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="schema" type="xs:string"/> 
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
    <xs:attribute name="where" type="xs:string"/> 
  </xs:complexType>

  <!-- The cache element enables caching of an entity class. -->
  <xs:complexType name="cache-element">
    <xs:attribute name="include" default="all">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="all"/>
          <xs:enumeration value="non-lazy"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="region" type="xs:string"/> 
    <xs:attribute name="usage" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="nonstrict-read-write"/>
          <xs:enumeration value="read-only"/>
          <xs:enumeration value="read-write"/>
          <xs:enumeration value="transactional"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <!-- The column element is an alternative to column attributes and required for 
  mapping associations to classes with composite ids. -->
  <xs:complexType name="column-element">
    <xs:sequence>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="default" type="xs:string"/> 
    <xs:attribute name="index" type="xs:string"/>
    <xs:attribute name="length" type="xs:string"/> 
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="not-null" type="xs:boolean"/> 
    <xs:attribute name="precision" type="xs:string"/>
    <xs:attribute name="read" type="xs:string"/> 
    <xs:attribute name="scale" type="xs:string"/>
    <xs:attribute name="sql-type" type="xs:string"/> 
    <xs:attribute name="unique" type="xs:boolean"/> 
    <xs:attribute name="unique-key" type="xs:string"/> 
    <xs:attribute name="write" type="xs:string"/> 
  </xs:complexType>

  <!-- A component is a user-defined class, persisted along with its containing entity
  to the table of the entity class. JavaBeans style properties of the component are
  mapped to columns of the table of the containing entity. A null component reference
  is mapped to null values in all columns and vice versa. Components do not support
  shared reference semantics. -->
  <xs:complexType name="component-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="tuplizer" minOccurs="0" maxOccurs="unbounded" type="tuplizer-element"/>
      <xs:element name="parent" minOccurs="0" type="parent-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="one-to-one" type="one-to-one-element"/>
        <xs:element name="component" type="component-element"/>
        <xs:element name="dynamic-component" type="dynamic-component-element"/>
        <xs:element name="any" type="any-element"/>
        <xs:element name="map" type="map-element"/>
        <xs:element name="set" type="set-element"/>
        <xs:element name="list" type="list-element"/>
        <xs:element name="bag" type="bag-element"/>
        <xs:element name="array" type="array-element"/>
        <xs:element name="primitive-array" type="primitive-array-element"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="class" type="xs:string"/>
    <xs:attribute name="insert" default="true" type="xs:boolean"/>
    <xs:attribute name="lazy" default="false" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/>
    <xs:attribute name="unique" default="false" type="xs:boolean"/>
    <xs:attribute name="update" default="true" type="xs:boolean"/>
  </xs:complexType>

  <!-- A composite element allows a collection to hold instances of an arbitrary 
  class, without the requirement of joining to an entity table. Composite elements
  have component semantics - no shared references and ad hoc null value semantics. 
  Composite elements may not hold nested collections. -->
  <xs:complexType name="composite-element-element">
    <xs:sequence>
      <xs:sequence>
        <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      </xs:sequence>
      <xs:element name="parent" minOccurs="0" type="parent-element"/>
      <xs:element name="tuplizer" minOccurs="0" maxOccurs="unbounded" type="tuplizer-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="any" type="any-element"/>
        <xs:element name="nested-composite-element" type="nested-composite-element-element"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="class" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
  </xs:complexType>

  <!-- A dynamic-component maps columns of the database entity to a java.util.Map 
  at the Java level -->
  <xs:complexType name="dynamic-component-element">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="one-to-one" type="one-to-one-element"/>
        <xs:element name="component" type="component-element"/>
        <xs:element name="dynamic-component" type="dynamic-component-element"/>
        <xs:element name="any" type="any-element"/>
        <xs:element name="map" type="map-element"/>
        <xs:element name="set" type="set-element"/>
        <xs:element name="list" type="list-element"/>
        <xs:element name="bag" type="bag-element"/>
        <xs:element name="array" type="array-element"/>
        <xs:element name="primitive-array" type="primitive-array-element"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="insert" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/>
    <xs:attribute name="unique" default="false" type="xs:boolean"/>
    <xs:attribute name="update" default="true" type="xs:boolean"/>
  </xs:complexType>

  <!-- Declares the element type of a collection of basic type -->
  <xs:complexType name="element-element">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="column" type="column-element"/>
        <!-- The formula and subselect elements allow us to map derived properties and 
        entities. -->
        <xs:element name="formula" type="xs:string"/>
      </xs:choice>
      <xs:element name="type" minOccurs="0" type="type-element"/>
    </xs:sequence>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="formula" type="xs:string"/>
    <xs:attribute name="length" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="not-null" default="false" type="xs:boolean"/>
    <xs:attribute name="precision" type="xs:string"/>
    <xs:attribute name="scale" type="xs:string"/>
    <xs:attribute name="type" type="xs:string"/>
    <xs:attribute name="unique" default="false" type="xs:boolean"/>
  </xs:complexType>

  <!--
  -->
  <xs:complexType name="fetch-profile-element">
    <xs:sequence>
      <!--
          The <fetch> element defines a single path to which the fetch
          refers, as well as the style of fetch to apply.  The 'root' of the
          path is different depending upon the context in which the
          containing <fetch-profile/> occurs; within a  element,
          the entity-name of the containing class mapping is assumed...
      -->
      <xs:element name="fetch" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="association" use="required" type="xs:string"/>
          <xs:attribute name="entity" type="xs:string"/> 
          <xs:attribute name="style" default="join">
            <xs:simpleType>
              <xs:restriction base="xs:token">
                <xs:enumeration value="join"/>
                <xs:enumeration value="select"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="name" use="required" type="xs:string"/>
  </xs:complexType>

  <!--
  	FILTER element; used to apply a filter.
  -->
  <xs:complexType name="filter-element" mixed="true">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="condition" type="xs:string"/>
        <xs:attribute name="name" use="required" type="xs:string"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- Generators generate unique identifiers. The class attribute specifies a Java 
  class implementing an id generation algorithm. -->
  <xs:complexType name="generator-element">
    <xs:sequence>
      <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="param-element"/>
    </xs:sequence>
    <xs:attribute name="class" use="required" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="idbag-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="cache" minOccurs="0" type="cache-element"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="collection-id">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
            <xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
            <xs:element name="generator" type="generator-element"/>
          </xs:sequence>
          <xs:attribute name="column" use="required" type="xs:string"/>
          <xs:attribute name="length" type="xs:string"/>
          <xs:attribute name="type" use="required" type="xs:string"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="key" type="key-element"/>
      <xs:choice>
        <xs:element name="element" type="element-element"/>
        <xs:element name="many-to-many" type="many-to-many-element"/>
        <xs:element name="composite-element" type="composite-element-element"/>
        <xs:element name="many-to-any" type="many-to-any-element"/>
      </xs:choice>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="sql-delete-all" minOccurs="0" type="sql-delete-all-element"/>
      <xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/> 
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="collection-type" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
    <xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
    <xs:attribute name="mutable" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="order-by" type="xs:string"/> 
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="schema" type="xs:string"/> 
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
    <xs:attribute name="where" type="xs:string"/> 
  </xs:complexType>

  <xs:complexType name="index-element">
    <xs:sequence>
      <xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
    </xs:sequence>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="length" type="xs:string"/>
    <xs:attribute name="type" type="xs:string"/> 
  </xs:complexType>

  <!-- A join allows some properties of a class to be persisted to a second table -->
  <xs:complexType name="join-element">
    <xs:sequence>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="key" type="key-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="component" type="component-element"/>
        <xs:element name="dynamic-component" type="dynamic-component-element"/>
        <xs:element name="any" type="any-element"/>
      </xs:choice>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
    </xs:sequence>
    <xs:attribute name="catalog" type="xs:string"/> 
    <xs:attribute name="fetch" default="join" type="fetch-attribute"/>
    <xs:attribute name="inverse" default="false" type="xs:boolean"/>
    <xs:attribute name="optional" default="false" type="xs:boolean"/>
    <xs:attribute name="schema" type="xs:string"/> 
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" use="required" type="xs:string"/>
  </xs:complexType>

  <!--
  	Joined subclasses are used for the normalized table-per-subclass mapping strategy
  	See the note on the class element regarding <pojo/> vs. @name usage...
  -->
  <xs:complexType name="joined-subclass-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="tuplizer" minOccurs="0" maxOccurs="unbounded" type="tuplizer-element"/>
      <xs:element name="key" type="key-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="one-to-one" type="one-to-one-element"/>
        <xs:element name="component" type="component-element"/>
        <xs:element name="dynamic-component" type="dynamic-component-element"/>
        <xs:element name="properties" type="properties-element"/>
        <xs:element name="any" type="any-element"/>
        <xs:element name="map" type="map-element"/>
        <xs:element name="set" type="set-element"/>
        <xs:element name="list" type="list-element"/>
        <xs:element name="bag" type="bag-element"/>
        <xs:element name="idbag" type="idbag-element"/>
        <xs:element name="array" type="array-element"/>
        <xs:element name="primitive-array" type="primitive-array-element"/>
      </xs:choice>
      <xs:element name="joined-subclass" minOccurs="0" maxOccurs="unbounded" type="joined-subclass-element"/>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
      <xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="query" type="query-element"/>
        <xs:element name="sql-query" type="sql-query-element"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="abstract" type="xs:boolean"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/>
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="dynamic-insert" default="false" type="xs:boolean"/>
    <xs:attribute name="dynamic-update" default="false" type="xs:boolean"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="extends" type="xs:string"/> 
    <xs:attribute name="lazy" type="xs:boolean"/>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="proxy" type="xs:string"/> 
    <xs:attribute name="schema" type="xs:string"/>
    <xs:attribute name="select-before-update" default="false" type="xs:boolean"/>
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
  </xs:complexType>

  <!-- Declares the column name of a foreign key. -->
  <xs:complexType name="key-element">
    <xs:sequence>
      <xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
    </xs:sequence>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="foreign-key" type="xs:string"/>
    <xs:attribute name="not-null" type="xs:boolean"/>
    <xs:attribute name="on-delete" default="noaction">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="cascade"/>
          <xs:enumeration value="noaction"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="property-ref" type="xs:string"/>
    <xs:attribute name="unique" type="xs:boolean"/>
    <xs:attribute name="update" type="xs:boolean"/>
  </xs:complexType>

  <!-- A many-to-one association embedded in a composite identifier or map index 
  (always not-null, never cascade). -->
  <xs:complexType name="key-many-to-one-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="class" type="xs:string"/>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="foreign-key" type="xs:string"/>
    <xs:attribute name="lazy" type="lazy-attribute"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
  </xs:complexType>

  <!-- A property embedded in a composite identifier or map index (always not-null). -->
  <xs:complexType name="key-property-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
      <xs:element name="type" minOccurs="0" type="type-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="length" type="xs:string"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="type" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="list-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="cache" minOccurs="0" type="cache-element"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="key" type="key-element"/>
      <xs:choice>
        <xs:element name="index" type="index-element"/>
        <xs:element name="list-index" type="list-index-element"/>
      </xs:choice>
      <xs:choice>
        <xs:element name="element" type="element-element"/>
        <xs:element name="one-to-many" type="one-to-many-element"/>
        <xs:element name="many-to-many" type="many-to-many-element"/>
        <xs:element name="composite-element" type="composite-element-element"/>
        <xs:element name="many-to-any" type="many-to-any-element"/>
      </xs:choice>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="sql-delete-all" minOccurs="0" type="sql-delete-all-element"/>
      <xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/> 
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="collection-type" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
    <xs:attribute name="inverse" default="false" type="xs:boolean"/>
    <xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
    <xs:attribute name="mutable" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="schema" type="xs:string"/> 
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
    <xs:attribute name="where" type="xs:string"/> 
  </xs:complexType>

  <!-- Declares the type and column mapping for a collection index (array or
  list index, or key of a map). -->
  <xs:complexType name="list-index-element">
    <xs:sequence>
      <xs:element name="column" minOccurs="0" type="column-element"/>
    </xs:sequence>
    <xs:attribute name="base" default="0" type="xs:string"/>
    <xs:attribute name="column" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="load-collection-element">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="return-property" type="return-property-element"/>
    </xs:sequence>
    <xs:attribute name="alias" use="required" type="xs:string"/>
    <xs:attribute name="lock-mode" default="read" type="lock-mode-attribute"/>
    <xs:attribute name="role" use="required" type="xs:string"/>
  </xs:complexType>

  <!-- The loader element allows specification of a named query to be used for fetching
  an entity or collection -->
  <xs:complexType name="loader-element">
    <xs:attribute name="query-ref" use="required" type="xs:string"/>
  </xs:complexType>

  <!-- A "many to any" defines a polymorphic association to any table 
  with the given identifier type. The first listed column is a VARCHAR column 
  holding the name of the class (for that row). -->
  <xs:complexType name="many-to-any-element">
    <xs:sequence>
      <xs:element name="meta-value" minOccurs="0" maxOccurs="unbounded" type="meta-value-element"/>
      <xs:element name="column" type="column-element"/>
    </xs:sequence>
    <xs:attribute name="id-type" use="required" type="xs:string"/>
    <xs:attribute name="meta-type" type="xs:string"/> 
  </xs:complexType>

  <!-- Many to many association. This tag declares the entity-class
  element type of a collection and specifies a many-to-many relational model -->
  <xs:complexType name="many-to-many-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="column" type="column-element"/>
        <!-- The formula and subselect elements allow us to map derived properties and 
        entities. -->
        <xs:element name="formula" type="xs:string"/>
      </xs:choice>
      <xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
    </xs:sequence>
    <xs:attribute name="class" type="xs:string"/>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="fetch" type="fetch-attribute"/>
    <xs:attribute name="foreign-key" type="xs:string"/>
    <xs:attribute name="formula" type="xs:string"/>
    <xs:attribute name="lazy" type="lazy-attribute"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="not-found" default="exception" type="not-found-attribute"/>
    <xs:attribute name="order-by" type="xs:string"/>
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="property-ref" type="xs:string"/>
    <xs:attribute name="unique" default="false" type="xs:boolean"/>
    <xs:attribute name="where" type="xs:string"/>
  </xs:complexType>

  <!-- Declares an association between two entities (Or from a component, component element,
  etc. to an entity). -->
  <xs:complexType name="many-to-one-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="column" type="column-element"/>
        <!-- The formula and subselect elements allow us to map derived properties and 
        entities. -->
        <xs:element name="formula" type="xs:string"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="class" type="xs:string"/>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="fetch" type="fetch-attribute"/>
    <xs:attribute name="foreign-key" type="xs:string"/>
    <xs:attribute name="formula" type="xs:string"/>
    <xs:attribute name="index" type="xs:string"/>
    <xs:attribute name="insert" default="true" type="xs:boolean"/>
    <xs:attribute name="lazy" type="lazy-attribute-with-no-proxy"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="not-found" default="exception" type="not-found-attribute"/>
    <xs:attribute name="not-null" type="xs:boolean"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="property-ref" type="xs:string"/>
    <xs:attribute name="unique" default="false" type="xs:boolean"/>
    <xs:attribute name="unique-key" type="xs:string"/>
    <xs:attribute name="update" default="true" type="xs:boolean"/>
  </xs:complexType>

  <!-- Collection declarations nested inside a class declaration indicate a foreign key 
  relationship from the collection table to the enclosing class. -->
  <xs:complexType name="map-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="cache" minOccurs="0" type="cache-element"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="key" type="key-element"/>
      <xs:choice>
        <xs:element name="map-key">
          <xs:complexType>
            <xs:sequence>
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="column" type="column-element"/>
                <!-- The formula and subselect elements allow us to map derived properties and 
                entities. -->
                <xs:element name="formula" type="xs:string"/>
              </xs:choice>
              <xs:element name="type" minOccurs="0" type="type-element"/>
            </xs:sequence>
            <xs:attribute name="column" type="xs:string"/>
            <xs:attribute name="formula" type="xs:string"/>
            <xs:attribute name="length" type="xs:string"/>
            <xs:attribute name="node" type="xs:string"/>
            <xs:attribute name="type" type="xs:string"/>
          </xs:complexType>
        </xs:element>
        <!-- Composite index of a map ie. a map keyed on components. -->
        <xs:element name="composite-map-key">
          <xs:complexType>
            <xs:sequence>
              <xs:choice maxOccurs="unbounded">
                <xs:element name="key-property" type="key-property-element"/>
                <xs:element name="key-many-to-one" type="key-many-to-one-element"/>
              </xs:choice>
            </xs:sequence>
            <xs:attribute name="class" use="required" type="xs:string"/>
          </xs:complexType>
        </xs:element>
        <!-- Many to many association mapped to the key of a map. ie. a map keyed
        on entities. -->
        <xs:element name="map-key-many-to-many">
          <xs:complexType>
            <xs:sequence>
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="column" type="column-element"/>
                <!-- The formula and subselect elements allow us to map derived properties and 
                entities. -->
                <xs:element name="formula" type="xs:string"/>
              </xs:choice>
            </xs:sequence>
            <xs:attribute name="class" type="xs:string"/>
            <xs:attribute name="column" type="xs:string"/>
            <xs:attribute name="entity-name" type="xs:string"/>
            <xs:attribute name="foreign-key" type="xs:string"/>
            <xs:attribute name="formula" type="xs:string"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="index" type="index-element"/>
        <xs:element name="composite-index">
          <xs:complexType>
            <xs:sequence>
              <xs:choice maxOccurs="unbounded">
                <xs:element name="key-property" type="key-property-element"/>
                <xs:element name="key-many-to-one" type="key-many-to-one-element"/>
              </xs:choice>
            </xs:sequence>
            <xs:attribute name="class" use="required" type="xs:string"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="index-many-to-many">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="column" minOccurs="0" maxOccurs="unbounded" type="column-element"/>
            </xs:sequence>
            <xs:attribute name="class" use="required" type="xs:string"/>
            <xs:attribute name="column" type="xs:string"/>
            <xs:attribute name="entity-name" type="xs:string"/>
            <xs:attribute name="foreign-key" type="xs:string"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="index-many-to-any">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="column" type="column-element"/>
            </xs:sequence>
            <xs:attribute name="id-type" use="required" type="xs:string"/>
            <xs:attribute name="meta-type" type="xs:string"/> 
          </xs:complexType>
        </xs:element>
      </xs:choice>
      <xs:choice>
        <xs:element name="element" type="element-element"/>
        <xs:element name="one-to-many" type="one-to-many-element"/>
        <xs:element name="many-to-many" type="many-to-many-element"/>
        <xs:element name="composite-element" type="composite-element-element"/>
        <xs:element name="many-to-any" type="many-to-any-element"/>
      </xs:choice>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="sql-delete-all" minOccurs="0" type="sql-delete-all-element"/>
      <xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/> 
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="collection-type" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
    <xs:attribute name="inverse" default="false" type="xs:boolean"/>
    <xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
    <xs:attribute name="mutable" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="order-by" type="xs:string"/> 
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="schema" type="xs:string"/> 
    <xs:attribute name="sort" default="unsorted" type="xs:string"/> 
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
    <xs:attribute name="where" type="xs:string"/> 
  </xs:complexType>

  <!--
  	<meta.../> is used to assign meta-level attributes to a class
  	or property.  Is currently used by codegenerator as a placeholder for
  	values that is not directly related to OR mappings.
  -->
  <xs:complexType name="meta-element" mixed="true">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="attribute" use="required" type="xs:string"/>
        <xs:attribute name="inherit" default="true" type="xs:boolean"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="meta-value-element">
    <xs:attribute name="class" use="required" type="xs:string"/>
    <xs:attribute name="value" use="required" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="nested-composite-element-element">
    <xs:sequence>
      <xs:element name="parent" minOccurs="0" type="parent-element"/>
      <xs:element name="tuplizer" minOccurs="0" maxOccurs="unbounded" type="tuplizer-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="any" type="any-element"/>
        <xs:element name="nested-composite-element" type="nested-composite-element-element"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="class" use="required" type="xs:string"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
  </xs:complexType>

  <!-- One to many association. This tag declares the entity-class
  element type of a collection and specifies a one-to-many relational model -->
  <xs:complexType name="one-to-many-element">
    <xs:attribute name="class" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="not-found" default="exception" type="not-found-attribute"/>
  </xs:complexType>

  <!-- Declares a one-to-one association between two entities (Or from a component, 
  component element, etc. to an entity). -->
  <xs:complexType name="one-to-one-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <!-- The formula and subselect elements allow us to map derived properties and 
      entities. -->
      <xs:element name="formula" minOccurs="0" maxOccurs="unbounded" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="class" type="xs:string"/>
    <xs:attribute name="constrained" default="false" type="xs:boolean"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="fetch" type="fetch-attribute"/>
    <xs:attribute name="foreign-key" type="xs:string"/>
    <xs:attribute name="formula" type="xs:string"/>
    <xs:attribute name="lazy" type="lazy-attribute-with-no-proxy"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="property-ref" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="param-element" mixed="true">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="name" use="required" type="xs:string"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- The parent element maps a property of the component class as a pointer back to
  the owning entity. -->
  <xs:complexType name="parent-element">
    <xs:attribute name="name" use="required" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="primitive-array-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="cache" minOccurs="0" type="cache-element"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="key" type="key-element"/>
      <xs:choice>
        <xs:element name="index" type="index-element"/>
        <xs:element name="list-index" type="list-index-element"/>
      </xs:choice>
      <xs:element name="element" type="element-element"/>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="sql-delete-all" minOccurs="0" type="sql-delete-all-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/> 
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="collection-type" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
    <xs:attribute name="mutable" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="schema" type="xs:string"/> 
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
    <xs:attribute name="where" type="xs:string"/> 
  </xs:complexType>

  <!-- properties declares that the contained properties form an alternate key. The name
  attribute allows an alternate key to be used as the target of a property-ref. -->
  <xs:complexType name="properties-element">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="component" type="component-element"/>
        <xs:element name="dynamic-component" type="dynamic-component-element"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="insert" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/>
    <xs:attribute name="unique" default="false" type="xs:boolean"/>
    <xs:attribute name="update" default="true" type="xs:boolean"/>
  </xs:complexType>

  <!-- Property of an entity class or component, component-element, composite-id, etc. 
  JavaBeans style properties are mapped to table columns. -->
  <xs:complexType name="property-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="column" type="column-element"/>
        <!-- The formula and subselect elements allow us to map derived properties and 
        entities. -->
        <xs:element name="formula" type="xs:string"/>
      </xs:choice>
      <xs:element name="type" minOccurs="0" type="type-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="formula" type="xs:string"/>
    <xs:attribute name="generated" default="never">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="always"/>
          <xs:enumeration value="insert"/>
          <xs:enumeration value="never"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="index" type="xs:string"/> 
    <xs:attribute name="insert" type="xs:boolean"/>
    <xs:attribute name="lazy" default="false" type="xs:boolean"/>
    <xs:attribute name="length" type="xs:string"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="not-null" type="xs:boolean"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="precision" type="xs:string"/>
    <xs:attribute name="scale" type="xs:string"/>
    <xs:attribute name="type" type="xs:string"/>
    <xs:attribute name="unique" default="false" type="xs:boolean"/>
    <xs:attribute name="unique-key" type="xs:string"/>
    <xs:attribute name="update" type="xs:boolean"/>
  </xs:complexType>

  <!-- The query element declares a named Hibernate query string -->
  <xs:complexType name="query-element" mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="query-param" type="query-param-element"/>
    </xs:sequence>
    <xs:attribute name="cache-mode" type="cache-mode-attribute"/>
    <xs:attribute name="cache-region" type="xs:string"/>
    <xs:attribute name="cacheable" default="false" type="xs:boolean"/>
    <xs:attribute name="comment" type="xs:string"/>
    <xs:attribute name="fetch-size" type="xs:string"/>
    <xs:attribute name="flush-mode" type="flush-mode-attribute"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="read-only" type="xs:boolean"/>
    <xs:attribute name="timeout" type="xs:string"/>
  </xs:complexType>

  <!-- The query-param element is used only by tools that generate
  finder methods for named queries -->
  <xs:complexType name="query-param-element">
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="type" use="required" type="xs:string"/>
  </xs:complexType>

  <!-- The resultset element declares a named resultset mapping definition for SQL queries -->
  <xs:complexType name="resultset-element">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="return-scalar" type="return-scalar-element"/>
      <xs:element name="return" type="return-element"/>
      <xs:element name="return-join" type="return-join-element"/>
      <xs:element name="load-collection" type="load-collection-element"/>
    </xs:choice>
    <xs:attribute name="name" use="required" type="xs:string"/>
  </xs:complexType>

  <!--
  	Defines a return component for a sql-query.  Alias refers to the alias
  	used in the actual sql query; lock-mode specifies the locking to be applied
  	when the query is executed.  The class, collection, and role attributes are mutually exclusive;
  	class refers to the class name of a "root entity" in the object result; collection refers
  	to a collection of a given class and is used to define custom sql to load that owned collection
  	and takes the form "ClassName.propertyName"; role refers to the property path for an eager fetch
  	and takes the form "owningAlias.propertyName"
  -->
  <xs:complexType name="return-element">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="return-discriminator" minOccurs="0">
        <xs:complexType>
          <xs:attribute name="column" use="required" type="xs:string"/>
        </xs:complexType>
      </xs:element>
      <xs:element name="return-property" type="return-property-element"/>
    </xs:sequence>
    <xs:attribute name="alias" type="xs:string"/>
    <xs:attribute name="class" type="xs:string"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="lock-mode" default="read" type="lock-mode-attribute"/>
  </xs:complexType>

  <xs:complexType name="return-join-element">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="return-property" type="return-property-element"/>
    </xs:sequence>
    <xs:attribute name="alias" use="required" type="xs:string"/>
    <xs:attribute name="lock-mode" default="read" type="lock-mode-attribute"/>
    <xs:attribute name="property" use="required" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="return-property-element">
    <xs:sequence>
      <xs:element name="return-column" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" use="required" type="xs:string"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="column" type="xs:string"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="return-scalar-element">
    <xs:attribute name="column" use="required" type="xs:string"/>
    <xs:attribute name="type" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="set-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="cache" minOccurs="0" type="cache-element"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="key" type="key-element"/>
      <xs:choice>
        <xs:element name="element" type="element-element"/>
        <xs:element name="one-to-many" type="one-to-many-element"/>
        <xs:element name="many-to-many" type="many-to-many-element"/>
        <xs:element name="composite-element" type="composite-element-element"/>
        <xs:element name="many-to-any" type="many-to-any-element"/>
      </xs:choice>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="sql-delete-all" minOccurs="0" type="sql-delete-all-element"/>
      <xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
    </xs:sequence>
    <xs:attribute name="access" type="xs:string"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="cascade" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/> 
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="collection-type" type="xs:string"/>
    <xs:attribute name="embed-xml" default="true" type="xs:boolean"/>
    <xs:attribute name="fetch" type="fetch-attribute-with-subselect"/>
    <xs:attribute name="inverse" default="false" type="xs:boolean"/>
    <xs:attribute name="lazy" type="lazy-attribute-with-extra"/>
    <xs:attribute name="mutable" default="true" type="xs:boolean"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="optimistic-lock" default="true" type="xs:boolean"/> 
    <xs:attribute name="order-by" type="xs:string"/> 
    <xs:attribute name="outer-join" type="outer-join-attribute"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="schema" type="xs:string"/> 
    <xs:attribute name="sort" default="unsorted" type="xs:string"/> 
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
    <xs:attribute name="where" type="xs:string"/> 
  </xs:complexType>

  <xs:complexType name="sql-delete-all-element" mixed="true">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="callable" default="false" type="xs:boolean"/>
        <xs:attribute name="check" type="check-attribute"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="sql-delete-element" mixed="true">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="callable" default="false" type="xs:boolean"/>
        <xs:attribute name="check" type="check-attribute"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- custom sql operations -->
  <xs:complexType name="sql-insert-element" mixed="true">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="callable" default="false" type="xs:boolean"/>
        <xs:attribute name="check" type="check-attribute"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!-- The sql-query element declares a named SQL query string -->
  <xs:complexType name="sql-query-element" mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="return-scalar" type="return-scalar-element"/>
      <xs:element name="return" type="return-element"/>
      <xs:element name="return-join" type="return-join-element"/>
      <xs:element name="load-collection" type="load-collection-element"/>
      <xs:element name="synchronize" type="synchronize-element"/>
      <xs:element name="query-param" type="query-param-element"/>
    </xs:choice>
    <xs:attribute name="cache-mode" type="cache-mode-attribute"/>
    <xs:attribute name="cache-region" type="xs:string"/>
    <xs:attribute name="cacheable" default="false" type="xs:boolean"/>
    <xs:attribute name="callable" default="false" type="xs:boolean"/>
    <xs:attribute name="comment" type="xs:string"/>
    <xs:attribute name="fetch-size" type="xs:string"/>
    <xs:attribute name="flush-mode" type="flush-mode-attribute"/>
    <xs:attribute name="name" use="required" type="xs:string"/>
    <xs:attribute name="read-only" type="xs:boolean"/>
    <xs:attribute name="resultset-ref" type="xs:string"/>
    <xs:attribute name="timeout" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="sql-update-element" mixed="true">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="callable" default="false" type="xs:boolean"/>
        <xs:attribute name="check" type="check-attribute"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!--
  	Subclass declarations are nested beneath the root class declaration to achieve
  	polymorphic persistence with the table-per-hierarchy mapping strategy.
  	See the note on the class element regarding <pojo/> vs. @name usage...
  -->
  <xs:complexType name="subclass-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="tuplizer" minOccurs="0" maxOccurs="unbounded" type="tuplizer-element"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="one-to-one" type="one-to-one-element"/>
        <xs:element name="component" type="component-element"/>
        <xs:element name="dynamic-component" type="dynamic-component-element"/>
        <xs:element name="any" type="any-element"/>
        <xs:element name="map" type="map-element"/>
        <xs:element name="set" type="set-element"/>
        <xs:element name="list" type="list-element"/>
        <xs:element name="bag" type="bag-element"/>
        <xs:element name="idbag" type="idbag-element"/>
        <xs:element name="array" type="array-element"/>
        <xs:element name="primitive-array" type="primitive-array-element"/>
      </xs:choice>
      <xs:element name="join" minOccurs="0" maxOccurs="unbounded" type="join-element"/>
      <xs:element name="subclass" minOccurs="0" maxOccurs="unbounded" type="subclass-element"/>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
      <xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="query" type="query-element"/>
        <xs:element name="sql-query" type="sql-query-element"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="abstract" type="xs:boolean"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="discriminator-value" type="xs:string"/> 
    <xs:attribute name="dynamic-insert" default="false" type="xs:boolean"/>
    <xs:attribute name="dynamic-update" default="false" type="xs:boolean"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="extends" type="xs:string"/> 
    <xs:attribute name="lazy" type="xs:boolean"/>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="proxy" type="xs:string"/> 
    <xs:attribute name="select-before-update" default="false" type="xs:boolean"/>
  </xs:complexType>

  <xs:complexType name="synchronize-element">
    <xs:attribute name="table" use="required" type="xs:string"/>
  </xs:complexType>

  <!--
      TUPLIZER element; defines tuplizer to use for a component/entity for a given entity-mode
  -->
  <xs:complexType name="tuplizer-element">
    <xs:attribute name="class" use="required" type="xs:string"/> 
    <xs:attribute name="entity-mode"> 
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="dom4j"/>
          <xs:enumeration value="dynamic-map"/>
          <xs:enumeration value="pojo"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:complexType>

  <!-- Declares the type of the containing property (overrides an eventually existing type
  attribute of the property). May contain param elements to customize a ParametrizableType. -->
  <xs:complexType name="type-element">
    <xs:sequence>
      <xs:element name="param" minOccurs="0" maxOccurs="unbounded" type="param-element"/>
    </xs:sequence>
    <xs:attribute name="name" use="required" type="xs:string"/>
  </xs:complexType>

  <!--
  	Union subclasses are used for the table-per-concrete-class mapping strategy
  	See the note on the class element regarding <pojo/> vs. @name usage...
  -->
  <xs:complexType name="union-subclass-element">
    <xs:sequence>
      <xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
      <xs:element name="subselect" minOccurs="0" type="xs:string"/>
      <xs:element name="synchronize" minOccurs="0" maxOccurs="unbounded" type="synchronize-element"/>
      <!-- The comment element allows definition of a database table or column comment. -->
      <xs:element name="comment" minOccurs="0" type="xs:string"/>
      <xs:element name="tuplizer" minOccurs="0" maxOccurs="unbounded" type="tuplizer-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="property" type="property-element"/>
        <xs:element name="many-to-one" type="many-to-one-element"/>
        <xs:element name="one-to-one" type="one-to-one-element"/>
        <xs:element name="component" type="component-element"/>
        <xs:element name="dynamic-component" type="dynamic-component-element"/>
        <xs:element name="properties" type="properties-element"/>
        <xs:element name="any" type="any-element"/>
        <xs:element name="map" type="map-element"/>
        <xs:element name="set" type="set-element"/>
        <xs:element name="list" type="list-element"/>
        <xs:element name="bag" type="bag-element"/>
        <xs:element name="idbag" type="idbag-element"/>
        <xs:element name="array" type="array-element"/>
        <xs:element name="primitive-array" type="primitive-array-element"/>
      </xs:choice>
      <xs:element name="union-subclass" minOccurs="0" maxOccurs="unbounded" type="union-subclass-element"/>
      <xs:element name="loader" minOccurs="0" type="loader-element"/>
      <xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
      <xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
      <xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
      <xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
      <xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="query" type="query-element"/>
        <xs:element name="sql-query" type="sql-query-element"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="abstract" type="xs:boolean"/>
    <xs:attribute name="batch-size" type="xs:string"/>
    <xs:attribute name="catalog" type="xs:string"/>
    <xs:attribute name="check" type="xs:string"/> 
    <xs:attribute name="dynamic-insert" default="false" type="xs:boolean"/>
    <xs:attribute name="dynamic-update" default="false" type="xs:boolean"/>
    <xs:attribute name="entity-name" type="xs:string"/>
    <xs:attribute name="extends" type="xs:string"/> 
    <xs:attribute name="lazy" type="xs:boolean"/>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="node" type="xs:string"/>
    <xs:attribute name="persister" type="xs:string"/>
    <xs:attribute name="proxy" type="xs:string"/> 
    <xs:attribute name="schema" type="xs:string"/>
    <xs:attribute name="select-before-update" default="false" type="xs:boolean"/>
    <xs:attribute name="subselect" type="xs:string"/>
    <xs:attribute name="table" type="xs:string"/> 
  </xs:complexType>

  <xs:simpleType name="cache-mode-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="get"/>
      <xs:enumeration value="ignore"/>
      <xs:enumeration value="normal"/>
      <xs:enumeration value="put"/>
      <xs:enumeration value="refresh"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="check-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="none"/>
      <xs:enumeration value="param"/>
      <xs:enumeration value="rowcount"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="fetch-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="join"/>
      <xs:enumeration value="select"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="fetch-attribute-with-subselect">
    <xs:restriction base="xs:token">
      <xs:enumeration value="join"/>
      <xs:enumeration value="select"/>
      <xs:enumeration value="subselect"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="flush-mode-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="always"/>
      <xs:enumeration value="auto"/>
      <xs:enumeration value="never"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="generated-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="always"/>
      <xs:enumeration value="never"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="lazy-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="false"/>
      <xs:enumeration value="proxy"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="lazy-attribute-with-extra">
    <xs:restriction base="xs:token">
      <xs:enumeration value="extra"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="true"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="lazy-attribute-with-no-proxy">
    <xs:restriction base="xs:token">
      <xs:enumeration value="false"/>
      <xs:enumeration value="no-proxy"/>
      <xs:enumeration value="proxy"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="lock-mode-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="none"/>
      <xs:enumeration value="read"/>
      <xs:enumeration value="upgrade"/>
      <xs:enumeration value="upgrade-nowait"/>
      <xs:enumeration value="write"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="not-found-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="exception"/>
      <xs:enumeration value="ignore"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="outer-join-attribute">
    <xs:restriction base="xs:token">
      <xs:enumeration value="auto"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="true"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate hibernate-mapping-4.0.xsd source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.