Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify entity mappings in JPA 2.1?

Tags:

java

orm

jpa

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.

like image 491
Jemolah Avatar asked Jun 14 '13 09:06

Jemolah


1 Answers

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"

like image 122
DataNucleus Avatar answered Oct 12 '22 01:10

DataNucleus