title: How to save ODocument in map field in Vertex with Java
body: <p>Assuming I have a Vertex (let's call it "PokemonMaster")</p>
  
  <pre><code>PokemonMaster
  {
   name, (STRING)
   age, (INTEGER)
   pokemons, (EMBEDDEDMAP) of Pokemon
  }
  </code></pre>
  
  <p>in my DB containing an EMBEDDEDMAP (I also tried with LINKMAP but I'm not sure of what i'm doing) of a class "Pokemon".</p>
  
  <p>I'm trying with Java to create the Vertex and put in the field "pokemons", some pokemons.</p>
  
  <p>let's say a Pokemon looks like :</p>
  
  <pre><code>Pokemon
  {
    name, (STRING)
  }
  </code></pre>
  
  <p>I'm doing something like :</p>
  
  <pre><code>Vertex v = graph.addVertex("class:PokemonMaster",
                             "name", "Sacha",
                             "age", "42",
                             "pokemons", new ODocument("Pokemon").field("name", "Pikachu")); 
  </code></pre>
  
  <p>I assume this would create a first element (Pikachu) in the map. And I was hoping to be able to add some Pokemons to my map later by doing something like :</p>
  
  <pre><code>v.setProperty("pokemons", new ODocument("Pokemon").field("name", "Raichu"));
  </code></pre>
  
  <p>All of this is actually not working and that's why i'm here, am I totally wrong?</p>
  
  <p>I get the error :</p>
  
  <pre><code>The field 'PokemonMaster.pokemons' has been declared as EMBEDDEDMAP but an incompatible type is used. Value: Pokemon{name:Pikachu}
  </code></pre>
  
  <p>Thank you !</p>
  
  <h2>Edit</h2>
  
  <p>I found the solution.
  Creating a map like :</p>
  
  <pre><code>Map&lt;String, ODocument&gt; foo = new HashMap&lt;&gt;();
  </code></pre>
  
  <p>Putting some pokemons in it :</p>
  
  <pre><code>ODocument doc = new ODocument("Pokemon").field("name", "Pikachu");
  ODocument doc2 = new ODocument("Pokemon").field("name", "Raichu");
  foo.put("pikachu", doc);
  foo.put("raichu", doc2);
  doc.save();
  doc2.save();
  </code></pre>
  
  <p>and simply giving the map as parameter :</p>
  
  <pre><code>Vertex v = graph.addVertex("class:PokemonMaster",
                             "name", "Sacha",
                             "age", "42",
                             "pokemons", foo);
  </code></pre>
  
  <p>Hope it will help someone ! </p>