MappingException for Map type of data

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.

Hi @abhishekmbmit,

In the future, you may be better off asking Java related questions in the Java SDK forum here: https://forums.couchbase.com/c/java-sdk

I’m tagging @daschl and @subhashni as a couple of people who might be able to help you.

Hi,
I am also facing same issue please help…

did you solve it brother ?

I am also facing The same issue can anyone resolved it??

If I have This type of data in Couchbase Like in One Json Array Conatins Json Object and Json Array then how to define Entity Object In Java for couchbase . When i am defining Through Map . I am getting error while fetching data from Couchbase through Java or Spring Boot
Caused by: java.lang.IllegalArgumentException: Basic type must not be null!

Have same issue. Is there any solution?

Hi,
I’m also facing same issue, any solutions please?

Hi Team,

I am also getting same issue while findById
java.lang.IllegalArgumentException: Basic type must not be null!

Can someone help me to resolve this issue.?