title: Why has this exception started occurring - java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject
body: <p>I am developing my first Java, MongoDB, Morphia application and cannot solve the following exception:-</p>
  
  <pre><code>java.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast to com.mongodb.DBObject
      at org.mongodb.morphia.mapping.EmbeddedMapper.fromDBObject(EmbeddedMapper.java:74)
      at org.mongodb.morphia.mapping.Mapper.readMappedField(Mapper.java:797)
      at org.mongodb.morphia.mapping.Mapper.fromDb(Mapper.java:250)
      at org.mongodb.morphia.mapping.Mapper.fromDBObject(Mapper.java:191)
      at org.mongodb.morphia.query.MorphiaIterator.convertItem(MorphiaIterator.java:134)
      at org.mongodb.morphia.query.MorphiaIterator.processItem(MorphiaIterator.java:146)
      at org.mongodb.morphia.query.MorphiaIterator.next(MorphiaIterator.java:117)
      at org.mongodb.morphia.query.QueryImpl.asList(QueryImpl.java:150)
      at test.DatabaseManagerTest.testListParent(DatabaseManagerTest.java:172)
  </code></pre>
  
  <p>My Tech Stack is as follows:-</p>
  
  <pre><code>Java 8 jdk1.8.0_112
  Morphia 1.2.1
  Mongo java driver 3.2.2
  </code></pre>
  
  <p>My Parent Entity class:-</p>
  
  <pre><code>@Entity("parent")
  public class Parent {
  
      @Id
      private ObjectId id;
  
      @Indexed(options = @IndexOptions(unique = false))
      private Child child;
  
      private String comment;
  
      private Date updateTimestamp;
  
  }
  </code></pre>
  
  <p>My Child entity:-</p>
  
  <pre><code>@Embedded
  public class Child {
  
      private int value;
      private String name;
  }
  </code></pre>
  
  <p>The JUNIT code that fails:-</p>
  
  <pre><code>final Datastore datastore = DatabaseManager.getDatastore();
  
  final Query&lt;Parent&gt; query = datastore.createQuery(Parent.class);
  final List&lt;Parent&gt; parents = query.asList(); &lt;&lt;&lt;&lt; EXCEPTION OCCURS HERE
  
  for (Parent parent : parents) {
      Assert.assertNotNull(parent);
  }
  </code></pre>
  
  <p>What mistake have I made in annotating my two entity classes?</p>
  
  <p>I guess its related to the embedded Child class as the stack trace mentions <code>org.mongodb.morphia.mapping.EmbeddedMapper</code>.</p>
  
  <p>What I find strange is that I havent chnaged the Parent and/or Child class in anyway, and all my tests used to pass fine.</p>
  
  <p>Today I re run my tests and they have started throwing this exception.</p>