Thank you, Albert, for your experimentation.  The updated schema definition
(openjpa_orm_1_0.xsd) and the example openjpa_orm.xml seems to be what we
are looking for.  I guess the only concern is whether we can count on other
JPA implementations to ignore this extra schema definition and just rely on
the standard orm.xsd.

Question:  Even if other JPA providers are smart enough to ignore our
specialized schema and use the standard JPA schema, what happens to our
extension elements?  Do they get ignored as well?  Or, will the verification
step still trip over these new/updated elements?

Thanks again,
Kevin


On 1/23/07, Albert Lee <[EMAIL PROTECTED]> wrote:

Somehow the one of the attachment (openjpa_orm_1_0.xsd) from my previous
note did not make it to this forum.

Try again here.
----------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!--
    OpenJPA specific orm.xml schema locates in: (E.g.)

http://incubator.apache.org/openjpa/xml/ns/persistence/openjpa_orm_1_0.xsd
"

    This schema extends http://java.sun.com/xml/ns/persistence/orm_1_0.xsd
with
        OpenJPA specific stanza and uses the same name space as
            "http://java.sun.com/xml/ns/persistence/orm";
-->
<xsd:schema
                 version="1.0"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema";
         targetNamespace=" http://java.sun.com/xml/ns/persistence/orm";
               xmlns:orm="http://java.sun.com/xml/ns/persistence/orm";
      elementFormDefault="qualified"
    attributeFormDefault="unqualified"
  >

  <xsd:annotation>
    <xsd:documentation>
      @(#)openjpa_orm_1_0.xsd 1.0  Jan 22 2007
    </xsd:documentation>
  </xsd:annotation>
  <xsd:annotation>
     <xsd:documentation><![CDATA[

       This is the XML Schema for extending the persistence
object-relational
       mapping file for OpenJPA specific features.

       The file may be named "META-INF/orm.xml" in the persistence
       archive or it may be named some other name which would be
       used to locate the file as resource on the classpath.

     ]]></xsd:documentation>
  </xsd:annotation>

  <!-- Redefine the orm_1_0.xsd with additional OpenJPA extensions -->
  <xsd:redefine 
schemaLocation="http://java.sun.com/xml/ns/persistence/orm_1_0.xsd
">

    <!--
        Append optional single <data-cache> element to <entity>.
          Valid values are "true" | "false" | "1" | "0".
          Default value is "false".
    -->
    <xsd:complexType name="entity">
      <xsd:complexContent>
        <xsd:extension base="orm:entity">
          <xsd:sequence>
            <xsd:element name="data-cache" type="xsd:boolean"
minOccurs="0" maxOccurs="1" default="false"/>
          </xsd:sequence>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>


    <!--
        Append optional single <jdbc-nonpolymorphic> element to
<one-to-many>.
          Valid values are "true" | "false" | "1" | "0".
          Default value is "false".

        Append optional single <jdbc-eager-fetch-mode> element to
<one-to-many>.
          Valid values are "parallel" | "others".
          Default value is "parallel".
    -->
    <xsd:complexType name="one-to-many">
      <xsd:complexContent>
        <xsd:extension base="orm:one-to-many">
          <xsd:sequence>

            <xsd:element name="jdbc-nonpolymorphic" type="xsd:boolean"
minOccurs="0" maxOccurs="1" default="false"/>

            <xsd:element name="jdbc-eager-fetch-mode" minOccurs="0"
maxOccurs="1" default="parallel">
              <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                  <xsd:enumeration value="parallel"/>
                  <xsd:enumeration value="others"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:element>

          </xsd:sequence>
        </xsd:extension>
      </xsd:complexContent>
    </xsd:complexType>

  </xsd:redefine>

</xsd:schema>


Albert Lee

Reply via email to