users@jpa-spec.java.net

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

From: guy pelletier <guy.pelletier_at_oracle.com>
Date: Tue, 29 Oct 2013 11:19:48 -0400

Hi Laird,

Try this:

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

replace the last "/" with a space.

Cheers,
Guy

On 29/10/2013 11:09 AM, Laird Nelson wrote:
> 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 schemaLocationto use?
>
> Thanks,
> Laird
>
> --
> http://about.me/lairdnelson