java - DataNucleus 中的@Convert

标签 java jpa datanucleus

有没有人设法在 DataNucleus 中使用 @Convert 注释?您有工作示例或文档链接吗?

我试过这样实现的

...
@Convert(converter = MyAttributeConverter.class)
private String[] aField;
...

MyAttributeConverter工具 javax.persistence.jpa21.AttributeConverter<String[], String> .

当我运行 DataNucleus Enhancer 时出现此错误

WARN [main] (Log4JLogger.java:96) - Class "XXX" has an annotation "javax.persistence.jpa21.Convert" specified with property "converter" yet this is invalid. Please check the specification for that annotation class. Errors were encountered when loading the specified MetaData files and classes. See the nested exceptions for details
ERROR [main] (Log4JLogger.java:125) - DataNucleus Enhancer completed with an error. Please review the enhancer log for full details. Some classes may have been enhanced but some caused errors Errors were encountered when loading the specified MetaData files and classes. See the nested exceptions for details org.datanucleus.exceptions.NucleusUserException: Errors were encountered when loading the specified MetaData files and classes. See the nested exceptions for details
    at org.datanucleus.metadata.MetaDataManager.loadClasses(MetaDataManager.java:536)
    ...

根据 DataNucleus 文档,似乎没问题:http://www.datanucleus.org/products/accessplatform/jpa/annotations.html#Convert ,虽然谷歌搜索我发现了一个问题报告,其中的事情有点不同:http://www.datanucleus.org/servlet/jira/browse/NUCJPA-164 .

我正在使用 DataNucleus 3.1.3。

最佳答案

关于java - DataNucleus 中的@Convert,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14582431/

相关文章:

java - Spring/JPA/persistence实体属性字段不能是final的?

jakarta-ee - Weld (CDI) 和 Datanucleus (JPA) 效果不佳,有优雅的解决方法吗?

java - 带权重SUM的三重线性布局

Java 在填满堆空间之前崩溃

java - Spring Boot Maven 项目的垃圾收集从不运行

java - JDO - 使用注释的 1-N 单向关系 - 列名称?

google-app-engine - 使用 DataNucleus 的列表排序扩展会导致空列表

java - 正确的循环方式以避免创建双对象

java - 如何在 Spring Data JPA 中将分页与条件查询结合起来?

java - 在 Play 中使用 save() 方法!具有继承性(JPA)