JPA 2.1 "Invalid persistence.xml" when adding "<description>" or "<jar-file>"

Description

Using this xml:

Hibernate fails to load when calling Persistence.createEntityManagerFactory("unitName");

Jars in Classpath are
hibernate-core-5.2.13.Final
hibernate-jpa-2.1-api-1.0.2.Final
hibernate-commons-annotations-5.0.1.Final

If I remove <description> tag, ORM starts up.

To me it seems Hibernate is trying to parse my xml according to something else than 2.1 spec, but dunno what's really going on.

Environment

None

Activity

Show:
Björn Schmidt
February 16, 2018, 8:18 AM

Sry, forgot StackTrace:

Also sry für stupid German error texts (what kind of deranged mind decides to translate error messages)?

Andrea Boriero
February 16, 2018, 4:03 PM

Hi ,
The xml is validated against http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd
and base on the xml schema
the

have to be the first element inside the

.

Björn Schmidt
February 19, 2018, 10:32 AM

Ty, classic RTFM usecase, although I have to ask:

Who reads 500+ pages of JPA documentation first.
Who though that xs:sequence instead of xs:all might be a good idea when the (counter intuitive) spec was created?

Vlad Mihalcea
February 19, 2018, 10:42 AM

Nowadays, the JPA spec is on GitHub so you can open an issue for the schema validation.

Assignee

Unassigned

Reporter

Björn Schmidt

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure