Reputation: 2192
A correct starting tag for the entity mappings file for JPA 2.0 was
<entity-mappings version="1.0" 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_1_0.xsd">
What are the required corrections for JPA 2.1?
I tried
<entity-mappings version="2.1" xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm">
But this gives the error:
No grammar constraints (DTD or XML Schema) referenced in the document.
Upvotes: 8
Views: 13348
Reputation: 1937
According to official documentation, section 12.3 XML Schema:
<entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm
http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd"
version="2.1">
...
</entity-mappings>
Upvotes: 6
Reputation: 2192
For version 2.1 the following is working:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
Upvotes: 1
Reputation: 15577
As per what the JPA 2.1 spec says perhaps ;-) or the docs of a JPA 2.1 implementation that tells you
Change java.sun.com to xmlns.jcp.org
Change orm_1_0 to orm_2_1
Change version="1.0" to version="2.1"
Upvotes: 8