While saving Map type data in couchBase I am getting an exception
Caused by: org.springframework.data.mapping.MappingException: Couldn’t find PersistentEntity for type java.lang.Object!
I’ve taken a map in DataModel
@Data
public class test {
private Map<String,Object> testMap;
}
I found this and override couchBase configuration to do customMapping in case of Object Type like
protected <R> R read(final TypeInformation<R> type, final CouchbaseDocument source,
final Object parent) {
if (Object.class == typeMapper.readType(source, type).getType()) {
return (R) source.export();
} else {
return super.read(type, source, parent);
}
}
It worked for the request like
{
“dummyMap”:{
“key1”:“val1”,
“key2”:“val2”
}
}
But failed for
{“dummyMap”: {
“key1”: “val1”,
“key2”: “val2”,
“objects”: [
{
“key1”: “val1”,
“key2”: “val2”
}
]
}
}
with exception
Caused by: java.lang.IllegalArgumentException: Basic type must not be null!
I guess it is because of the array. Please let me know what I am doing wrong.
I am using spring-data-couchbase version 2.0.4.RELEASE.