I have a pojo class (Location
) which have a property as
@Collection(jcrType="nt:map") Map<String, String> map;
Now when i am trying to insert a Location objeect in jackrabbit repository. It is giving error as:
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)
How i can save a object in the repository? Thanks in advance.
I was also facing the same problem. Take a look at this link http://osdir.com/ml/users.jackrabbit.apache.org/2009-06/msg00129.html
By default, @Collection
is not supporting maps based on <String, String>
,
the elements have to be beans based classes, not primitive types. If you
want to use primitive types or wrapper classes, you have to use the
collection converter MultiValueCollectionConverterImpl
.
Though the problem was solved I am still not sure how the values are stored.