我在使用 hibernate 元模型生成器时遇到问题:
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'.]
这是我的 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>
当前版本(1.2.Final)似乎不支持 JPA 2.1,并且我在 git 存储库中没有找到该生成器的任何 beta 版本。还有哪些其他选项可以生成元模型类?我使用 Wildfly 作为应用程序服务器。
最佳答案
新版本 (1.3.0.Final) 已于 2013 年 8 月 9 日发布,应该可以解决您的问题。
关于java - 使用 JPA 2.1 生成元模型类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17764060/