2013-06-14 10 views
6

Ein korrekter Start-Tag für die Datei Entitätszuordnungen für JPA 2.0 warWie Sie Entitätszuordnungen in JPA 2.1 angeben?

<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"> 

Was sind die erforderlichen Korrekturen für 2.1 JPA?

versuchte ich

<entity-mappings version="2.1" xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm"> 

Aber das gibt den Fehler:

No grammar constraints (DTD or XML Schema) referenced in the document.

+1

tha t ist ein Start-Tag für JPA 1.0 nicht 2.0 –

Antwort

1

Für Version 2.1 folgendes funktioniert:

<?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"> 
3

Nach official documentation Abschnitt 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> 
Verwandte Themen