title: java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable
body: <p>I'm getting the following exception when attempting to save a simple POJO with a map field.</p>
  
  <p>Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable</p>
  
  <p>Here's my code:</p>
  
  <pre><code>package com.example.test;
  
  import com.orientechnologies.orient.client.remote.OServerAdmin;
  import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
  import com.orientechnologies.orient.object.db.OObjectDatabaseTx;
  
  import java.io.IOException;
  import java.util.HashMap;
  import java.util.Map;
  
  public class Main {
  
      static class Entity {
  
          private Map map;
  
          public Entity() {
          }
  
          public Entity(Map map) {
              this.map = map;
          }
  
          public Map getMap() {
              return map;
          }
  
          public void setMap(Map map) {
              this.map = map;
          }
      }
  
      private static void doIt() {
          String dbUser = "root";
          String dbPass = "root";
          String dbUrl = "remote:localhost:2424/sandbox";
          try {
              OServerAdmin serverAdmin = new OServerAdmin(dbUrl);
              serverAdmin.connect(dbUser, dbPass);
              if (serverAdmin.existsDatabase("plocal")) {
                  serverAdmin.dropDatabase("plocal");
              }
              serverAdmin.createDatabase("document", "plocal");
          } catch (IOException e) {
              e.printStackTrace();
              throw new RuntimeException(e);
          }
          ODatabaseDocumentTx databaseDocumentTx = new ODatabaseDocumentTx(dbUrl);
          databaseDocumentTx.open(dbUser, dbPass);
  
          OObjectDatabaseTx objectDatabaseTx = new OObjectDatabaseTx(databaseDocumentTx);
          objectDatabaseTx.getEntityManager().registerEntityClass(Entity.class);
  
          Map map = new HashMap();
          map.put("a", "a");
          Entity entity = objectDatabaseTx.save(new Entity(map)); //&lt;-- EXCEPTION THROWN HERE!!!
      }
  
      public static void main(String[] args) {
          doIt();
      }
  
  }
  </code></pre>
  
  <p>Full stack trace:</p>
  
  <pre>
  <code>
      Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable
          at com.orientechnologies.orient.core.db.record.ORecordLazyMap.put(ORecordLazyMap.java:41)
          at com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.multiValueToStream(OObjectEntitySerializer.java:1398)
          at com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.typeToStream(OObjectEntitySerializer.java:805)
          at com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.toStream(OObjectEntitySerializer.java:1216)
          at com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.serializeObject(OObjectEntitySerializer.java:144)
          at com.orientechnologies.orient.object.db.OObjectDatabaseTx.save(OObjectDatabaseTx.java:454)
          at com.orientechnologies.orient.object.db.OObjectDatabaseTx.save(OObjectDatabaseTx.java:399)
          at com.example.test.Main.doIt(Main.java:56)
          at com.example.test.Main.main(Main.java:60)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
  
  </code>
  </pre>
  
  <p>Any guidance as to what is going on would greatly be appreciated!</p>