有没有人设法将 @Convert 注释与 DataNucleus 一起使用?您有工作示例或文档链接吗?
我试图以这种方式实现它
...
@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。