users@jpa-spec.java.net

[jpa-spec users] persistence.xml schemaLocation not right?

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Tue, 29 Oct 2013 08:09:44 -0700

The persistence.xml schema has the following towards the top of the file:

     <xsd:documentation><![CDATA[

       This is the XML Schema for the persistence object/relational
       mapping file.
       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.

       Object/relational mapping files must indicate the object/relational
       mapping file schema by using the persistence namespace:

       http://java.sun.com/xml/ns/persistence

       and indicate the version of the schema by
       using the version element as shown below:

      <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
          *http://java.sun.com/xml/ns/persistence/orm/orm_2_0.xsd*"
        version="2.0">
          ...
      </entity-mappings>


     ]]></xsd:documentation>

Note the value of the xsi:schemaLocation attribute in this example,
specifically the URL designating the actual location:

    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
          http://java.sun.com/xml/ns/persistence/*orm/*orm_2_0.xsd"

That URL, http://java.sun.com/xml/ns/persistence/orm/orm_2_0.xsd, does not
resolve.

But removing the last orm/ element does make it resolve.

What is the proper schemaLocation to use?

Thanks,
Laird

-- 
http://about.me/lairdnelson