Question

I have problems using hibernate metamodel generator:

java: Error unmarshalling /META-INF/persistence.xml with exception :
   javax.xml.bind.UnmarshalException
   - with linked exception:
  [org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 103; cvc-elt.1: Cannot find the declaration of element 'persistence'.]

Here is my persistence.xml:

<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://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd">

  <persistence-unit name="wespital" transaction-type="JTA">
    <jta-data-source>jdbc/wespital</jta-data-source>
  </persistence-unit>
</persistence>

It seems that current version (1.2.Final) does not support JPA 2.1 and I didn't find any beta-versions of this generator in the git repository. What other options could be to generate metamodel classes? I use wildfly as app server.

Was it helpful?

Solution

A new version (1.3.0.Final) has been released on August 9, 2013 that should solve your problems.

OTHER TIPS

DataNucleus JPA metamodel generator generates classes suitable for JPA 2.0/2.1, see the DataNucleus docs.

I used metamodel generator from the eclipselink project, it seems to work fine.

<dependency>
  <groupId>org.eclipse.persistence</groupId>
  <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
  <version>2.5.0</version>
  <scope>provided</scope>
</dependency>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top