Подтвердить что ты не робот

Как указать JPA 2.1 в файле persistence.xml?

Быстрый поиск в сети показывает три или четыре варианта, как люди указывали xmlns и xsi:schemaLocation в persistence.xml.

Как правильно указать JPA версии 2.1?

Я использую

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

Ответ 1

В соответствии с официальной документацией она должна быть (например, ваша):

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