我有一个 pojo 类(Location
),其属性为
@Collection(jcrType="nt:map") Map<String, String> map;
现在,当我尝试在 jackrabbit 存储库中插入位置对象时。 它给出的错误为:
org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException: Class of type: java.lang.String has no descriptor.
at org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl.getClassDescriptorByClass(AbstractMapperImpl.java:203)
at org.apache.jackrabbit.ocm.manager.collectionconverter.impl.DefaultCollectionConverterImpl.doInsertCollection(DefaultCollectionConverterImpl.java:116)
at org.apache.jackrabbit.ocm.manager.collectionconverter.impl.AbstractCollectionConverterImpl.insertCollection(AbstractCollectionConverterImpl.java:80)
如何在存储库中保存对象? 提前致谢。
最佳答案
我也遇到了同样的问题。看看这个链接 http://osdir.com/ml/users.jackrabbit.apache.org/2009-06/msg00129.html
默认情况下,@Collection
不支持基于 <String, String>
的 map ,
元素必须是基于 Bean 的类,而不是原始类型。如果你
想要使用原始类型或包装类,你必须使用
采集转换器MultiValueCollectionConverterImpl
.
虽然问题已经解决,但我仍然不确定这些值是如何存储的。
关于java - 如何将一个对象保存在 Jackrabbit 存储库中,将 map 作为一个字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13679533/