org.springframework.data.mapping.model.MappingException: No mapping metadata found for class com.mongodb.BasicDBObject

Spring JIRA | Marcin Kowalski | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    For repository method definition like below: {code:java} @Query("{meanings: {$not: {$size: 0}}}") Page<Entry> findAllWithMeanings(Pageable pageable); {code} Entry documents contain {{meanings}} field which is a list of {{@DBRef}} s. When I remove {{@DBRef}} annotation it works ok, but otherwise I get the following exception: {noformat} Exception in thread "main" org.springframework.data.mapping.model.MappingException: No mapping metadata found for class com.mongodb.BasicDBObject at org.springframework.data.mongodb.core.convert.MappingMongoConverter.createDBRef(MappingMongoConverter.java:729) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.toDBRef(MappingMongoConverter.java:288) at org.springframework.data.mongodb.core.convert.QueryMapper.convertAssociation(QueryMapper.java:273) at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedKeyword(QueryMapper.java:158) at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObject(QueryMapper.java:111) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1489) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1480) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:527) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery$PagedExecution.execute(AbstractMongoQuery.java:205) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:93) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:337) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) … {noformat}

    Spring JIRA | 3 years ago | Marcin Kowalski
    org.springframework.data.mapping.model.MappingException: No mapping metadata found for class com.mongodb.BasicDBObject
  2. 0

    For repository method definition like below: {code:java} @Query("{meanings: {$not: {$size: 0}}}") Page<Entry> findAllWithMeanings(Pageable pageable); {code} Entry documents contain {{meanings}} field which is a list of {{@DBRef}} s. When I remove {{@DBRef}} annotation it works ok, but otherwise I get the following exception: {noformat} Exception in thread "main" org.springframework.data.mapping.model.MappingException: No mapping metadata found for class com.mongodb.BasicDBObject at org.springframework.data.mongodb.core.convert.MappingMongoConverter.createDBRef(MappingMongoConverter.java:729) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.toDBRef(MappingMongoConverter.java:288) at org.springframework.data.mongodb.core.convert.QueryMapper.convertAssociation(QueryMapper.java:273) at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedKeyword(QueryMapper.java:158) at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObject(QueryMapper.java:111) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1489) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1480) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:527) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery$PagedExecution.execute(AbstractMongoQuery.java:205) at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:93) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:337) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) … {noformat}

    Spring JIRA | 3 years ago | Marcin Kowalski
    org.springframework.data.mapping.model.MappingException: No mapping metadata found for class com.mongodb.BasicDBObject
  3. 0

    Spring MongoDB $size query throws exception "org.springframework.data.mapping.model.MappingException"

    Stack Overflow | 4 years ago | rohit kotian
    org.springframework.data.mapping.model.MappingException: No mapping metadata found for class java.lang.Integer
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.data.mapping.model.MappingException

      No mapping metadata found for class com.mongodb.BasicDBObject

      at org.springframework.data.mongodb.core.convert.MappingMongoConverter.createDBRef()
    2. Spring Data MongoDB - Core
      AbstractMongoQuery.execute
      1. org.springframework.data.mongodb.core.convert.MappingMongoConverter.createDBRef(MappingMongoConverter.java:729)
      2. org.springframework.data.mongodb.core.convert.MappingMongoConverter.toDBRef(MappingMongoConverter.java:288)
      3. org.springframework.data.mongodb.core.convert.QueryMapper.convertAssociation(QueryMapper.java:273)
      4. org.springframework.data.mongodb.core.convert.QueryMapper.getMappedKeyword(QueryMapper.java:158)
      5. org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObject(QueryMapper.java:111)
      6. org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1489)
      7. org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1480)
      8. org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:527)
      9. org.springframework.data.mongodb.repository.query.AbstractMongoQuery$PagedExecution.execute(AbstractMongoQuery.java:205)
      10. org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:93)
      10 frames
    3. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:337)
      1 frame
    4. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames