60

A quick search on the Net reveals three or four variants how folks have been specifying xmlns and xsi:schemaLocation in persistence.xml.

What would be the 'correct' manner to specify JPA version 2.1?

I'm using

<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">
Sae1962
  • 1,122
  • 15
  • 31
kmansoor
  • 4,265
  • 9
  • 52
  • 95

1 Answers1

110

According to the official documentation it must be (like yours):

<persistence 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"
             version="2.1">
    ...
</persistence>
Tiny
  • 27,221
  • 105
  • 339
  • 599
V G
  • 18,822
  • 6
  • 51
  • 89
  • 4
    +1. @kmansoor As an addition, to point out the exact place where this configuration is shown, one can see the related XSD file (starting from line 50): http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd – informatik01 Mar 09 '15 at 10:19