java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject

Hibernate JIRA | Alexander Morozov | 2 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

    See PR for test case. Here is the stack trace: {code} ests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.772 sec <<< FAILURE! - in org.hibernate.ogm.datastore.mongodb.test.id.embeddedid.EmbeddedIdTest listAllEntitiesWithEmbeddedId(org.hibernate.ogm.datastore.mongodb.test.id.embeddedid.EmbeddedIdTest) Time elapsed: 0.696 sec <<< ERROR! java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject at org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoDBTupleSnapshot.getKeyColumnValue(MongoDBTupleSnapshot.java:81) at org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoDBTupleSnapshot.get(MongoDBTupleSnapshot.java:75) at org.hibernate.ogm.model.spi.Tuple.get(Tuple.java:50) at org.hibernate.ogm.type.descriptor.impl.BasicGridExtractor.extract(BasicGridExtractor.java:36) at org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:226) at org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:222) at org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:213) at org.hibernate.ogm.type.impl.AbstractGenericBasicType.hydrate(AbstractGenericBasicType.java:313) at org.hibernate.ogm.type.impl.ComponentType.hydrate(ComponentType.java:96) at org.hibernate.ogm.type.impl.ComponentType.nullSafeGet(ComponentType.java:42) at org.hibernate.ogm.loader.impl.OgmLoader.extractKeysFromResultSet(OgmLoader.java:543) at org.hibernate.ogm.loader.impl.OgmLoader.getRowFromResultSet(OgmLoader.java:487) at org.hibernate.ogm.loader.impl.OgmLoader.doQuery(OgmLoader.java:371) at org.hibernate.ogm.loader.impl.OgmLoader.doQueryAndInitializeNonLazyCollections(OgmLoader.java:281) at org.hibernate.ogm.loader.impl.OgmLoader.loadEntity(OgmLoader.java:200) at org.hibernate.ogm.loader.impl.OgmLoader.loadEntities(OgmLoader.java:218) at org.hibernate.ogm.query.impl.OgmQueryLoader.listOfEntities(OgmQueryLoader.java:90) at org.hibernate.ogm.query.impl.OgmQueryLoader.list(OgmQueryLoader.java:76) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501) at org.hibernate.ogm.query.impl.OgmQueryTranslator.list(OgmQueryTranslator.java:127) at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:220) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1268) at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87) at org.hibernate.ogm.datastore.mongodb.test.id.embeddedid.EmbeddedIdTest.listAllEntitiesWithEmbeddedId(EmbeddedIdTest.java:35) Results : Tests in error: EmbeddedIdTest.listAllEntitiesWithEmbeddedId:35 » ClassCast java.lang.String c... {code}

    Hibernate JIRA | 2 years ago | Alexander Morozov
    java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject
  2. 0

    See PR for test case. Here is the stack trace: {code} ests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.772 sec <<< FAILURE! - in org.hibernate.ogm.datastore.mongodb.test.id.embeddedid.EmbeddedIdTest listAllEntitiesWithEmbeddedId(org.hibernate.ogm.datastore.mongodb.test.id.embeddedid.EmbeddedIdTest) Time elapsed: 0.696 sec <<< ERROR! java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject at org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoDBTupleSnapshot.getKeyColumnValue(MongoDBTupleSnapshot.java:81) at org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoDBTupleSnapshot.get(MongoDBTupleSnapshot.java:75) at org.hibernate.ogm.model.spi.Tuple.get(Tuple.java:50) at org.hibernate.ogm.type.descriptor.impl.BasicGridExtractor.extract(BasicGridExtractor.java:36) at org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:226) at org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:222) at org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:213) at org.hibernate.ogm.type.impl.AbstractGenericBasicType.hydrate(AbstractGenericBasicType.java:313) at org.hibernate.ogm.type.impl.ComponentType.hydrate(ComponentType.java:96) at org.hibernate.ogm.type.impl.ComponentType.nullSafeGet(ComponentType.java:42) at org.hibernate.ogm.loader.impl.OgmLoader.extractKeysFromResultSet(OgmLoader.java:543) at org.hibernate.ogm.loader.impl.OgmLoader.getRowFromResultSet(OgmLoader.java:487) at org.hibernate.ogm.loader.impl.OgmLoader.doQuery(OgmLoader.java:371) at org.hibernate.ogm.loader.impl.OgmLoader.doQueryAndInitializeNonLazyCollections(OgmLoader.java:281) at org.hibernate.ogm.loader.impl.OgmLoader.loadEntity(OgmLoader.java:200) at org.hibernate.ogm.loader.impl.OgmLoader.loadEntities(OgmLoader.java:218) at org.hibernate.ogm.query.impl.OgmQueryLoader.listOfEntities(OgmQueryLoader.java:90) at org.hibernate.ogm.query.impl.OgmQueryLoader.list(OgmQueryLoader.java:76) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501) at org.hibernate.ogm.query.impl.OgmQueryTranslator.list(OgmQueryTranslator.java:127) at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:220) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1268) at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87) at org.hibernate.ogm.datastore.mongodb.test.id.embeddedid.EmbeddedIdTest.listAllEntitiesWithEmbeddedId(EmbeddedIdTest.java:35) Results : Tests in error: EmbeddedIdTest.listAllEntitiesWithEmbeddedId:35 » ClassCast java.lang.String c... {code}

    Hibernate JIRA | 2 years ago | Alexander Morozov
    java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.String cannot be cast to com.mongodb.DBObject

      at org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoDBTupleSnapshot.getKeyColumnValue()
    2. org.hibernate.ogm
      MongoDBTupleSnapshot.get
      1. org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoDBTupleSnapshot.getKeyColumnValue(MongoDBTupleSnapshot.java:81)
      2. org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoDBTupleSnapshot.get(MongoDBTupleSnapshot.java:75)
      2 frames
    3. Hibernate Object Grid Mapper
      OgmQueryLoader.list
      1. org.hibernate.ogm.model.spi.Tuple.get(Tuple.java:50)
      2. org.hibernate.ogm.type.descriptor.impl.BasicGridExtractor.extract(BasicGridExtractor.java:36)
      3. org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:226)
      4. org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:222)
      5. org.hibernate.ogm.type.impl.AbstractGenericBasicType.nullSafeGet(AbstractGenericBasicType.java:213)
      6. org.hibernate.ogm.type.impl.AbstractGenericBasicType.hydrate(AbstractGenericBasicType.java:313)
      7. org.hibernate.ogm.type.impl.ComponentType.hydrate(ComponentType.java:96)
      8. org.hibernate.ogm.type.impl.ComponentType.nullSafeGet(ComponentType.java:42)
      9. org.hibernate.ogm.loader.impl.OgmLoader.extractKeysFromResultSet(OgmLoader.java:543)
      10. org.hibernate.ogm.loader.impl.OgmLoader.getRowFromResultSet(OgmLoader.java:487)
      11. org.hibernate.ogm.loader.impl.OgmLoader.doQuery(OgmLoader.java:371)
      12. org.hibernate.ogm.loader.impl.OgmLoader.doQueryAndInitializeNonLazyCollections(OgmLoader.java:281)
      13. org.hibernate.ogm.loader.impl.OgmLoader.loadEntity(OgmLoader.java:200)
      14. org.hibernate.ogm.loader.impl.OgmLoader.loadEntities(OgmLoader.java:218)
      15. org.hibernate.ogm.query.impl.OgmQueryLoader.listOfEntities(OgmQueryLoader.java:90)
      16. org.hibernate.ogm.query.impl.OgmQueryLoader.list(OgmQueryLoader.java:76)
      16 frames
    4. Hibernate
      QueryLoader.list
      1. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
      1 frame
    5. Hibernate Object Grid Mapper
      OgmQueryTranslator.list
      1. org.hibernate.ogm.query.impl.OgmQueryTranslator.list(OgmQueryTranslator.java:127)
      1 frame
    6. Hibernate
      QueryImpl.list
      1. org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:220)
      2. org.hibernate.internal.SessionImpl.list(SessionImpl.java:1268)
      3. org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
      3 frames
    7. org.hibernate.ogm
      EmbeddedIdTest.listAllEntitiesWithEmbeddedId
      1. org.hibernate.ogm.datastore.mongodb.test.id.embeddedid.EmbeddedIdTest.listAllEntitiesWithEmbeddedId(EmbeddedIdTest.java:35)
      1 frame