无法在没有 JDO 注释的情况下使用 DataNucleus 增强器
Unable to use DataNucleus enhancer without JDO annotations
我正在尝试将 DataNucleus 与 JDO api 一起使用,仅使用 XML 来定义持久性模型,而不添加 @PersistenceCapable 之类的注释。如果我确实理解这两个文档,那么 JDO 和 DataNucleus 应该都支持这一点。
例如,如果我删除 datanucleus example 和 运行 mvn clean compile
中 Book.java、Inventory.java、Product.java 的所有注释,我应该得到工作完成了,因为 package.orm 定义了那些 类,但是对于所有这些 类:
我得到了以下错误
(main) DEBUG [DataNucleus.MetaData] - Class
org.datanucleus.samples.jdo.tutorial.Inventory was specified in
persistence-unit (maybe by not putting exclude-unlisted-classes)
Tutorial but not annotated, so ignoring
....
(main) INFO [DataNucleus.Enhancer] - DataNucleus Enhancer completed with success for 0 classes.
我错过了什么?
实际配置文件:
persistence.xml
...
<persistence-unit name="Tutorial">
<class>org.datanucleus.samples.jdo.tutorial.Inventory</class>
<class>org.datanucleus.samples.jdo.tutorial.Product</class>
<class>org.datanucleus.samples.jdo.tutorial.Book</class>
<exclude-unlisted-classes/>
...
</persistence-unit>
...
package-h2.orm
<orm>
<package name="org.datanucleus.samples.jdo.tutorial">
<!-- persistence-modifier is by default equal to: persistence-capable -->
<class name="Inventory" table="INVENTORIES" >...</class>
<class name="Product" table="PRODUCTS">...</class>
<class name="Book" table="BOOKS">...</class>
</orm>
ORM 元数据将覆盖 JDO 元数据。因此,您需要注释或 JDO XML 元数据文件 (package.jdo)。
"class"条目在persistence.xml
中指定类有注解,你说你有none。
"mapping-file" persistence.xml
中的条目用于指定 XML 元数据文件...而您尚未指定任何内容。
我正在尝试将 DataNucleus 与 JDO api 一起使用,仅使用 XML 来定义持久性模型,而不添加 @PersistenceCapable 之类的注释。如果我确实理解这两个文档,那么 JDO 和 DataNucleus 应该都支持这一点。
例如,如果我删除 datanucleus example 和 运行 mvn clean compile
中 Book.java、Inventory.java、Product.java 的所有注释,我应该得到工作完成了,因为 package.orm 定义了那些 类,但是对于所有这些 类:
(main) DEBUG [DataNucleus.MetaData] - Class org.datanucleus.samples.jdo.tutorial.Inventory was specified in persistence-unit (maybe by not putting exclude-unlisted-classes) Tutorial but not annotated, so ignoring
....
(main) INFO [DataNucleus.Enhancer] - DataNucleus Enhancer completed with success for 0 classes.
我错过了什么?
实际配置文件:
persistence.xml
...
<persistence-unit name="Tutorial">
<class>org.datanucleus.samples.jdo.tutorial.Inventory</class>
<class>org.datanucleus.samples.jdo.tutorial.Product</class>
<class>org.datanucleus.samples.jdo.tutorial.Book</class>
<exclude-unlisted-classes/>
...
</persistence-unit>
...
package-h2.orm
<orm>
<package name="org.datanucleus.samples.jdo.tutorial">
<!-- persistence-modifier is by default equal to: persistence-capable -->
<class name="Inventory" table="INVENTORIES" >...</class>
<class name="Product" table="PRODUCTS">...</class>
<class name="Book" table="BOOKS">...</class>
</orm>
ORM 元数据将覆盖 JDO 元数据。因此,您需要注释或 JDO XML 元数据文件 (package.jdo)。
"class"条目在persistence.xml
中指定类有注解,你说你有none。
"mapping-file" persistence.xml
中的条目用于指定 XML 元数据文件...而您尚未指定任何内容。