title: Jackson : Losing type information
body: <p>I am trying to serialize/deserialize the following</p>
  
  <pre><code>@JsonTypeInfo(use = JsonTypeInfo.Id.NAME)
  @JsonSubTypes({ 
      @JsonSubTypes.Type(value = IdBundleCombine.class), 
      @JsonSubTypes.Type(value = IdBundleDistinct.class) })
  public abstract class IdBundle
  {
      String sharedId;
      Long   internalId;
      //getters
  }
  
  public class IdBundleCombine extends IdBundle
  {
      //setters
  }
  
  public class IdBundleDistinct extends IdBundle
  {
      //setters
  }
  </code></pre>
  
  <p>with the following code</p>
  
  <pre><code>ObjectMapper mapper = new ObjectMapper();
  mapper.writeValue(new File("foo.json"), someInstanceOfIdBundle);
  </code></pre>
  
  <p>Which produce the following (without type information as you can see):</p>
  
  <pre><code>{"sharedId":"foobar","internalId":1234}
  </code></pre>
  
  <p>So i get an error <code>missing property '@type' that is to contain type id</code> when I try to deserialize it.</p>
  
  <p>I tried every combination of parameters for  <code>@JsonTypeInfo</code> and <code>@JsonSubTypes</code> I could find without ever succeeding in getting the type information to show in my file. I also tried to play with the <code>@JsonTypeName</code> on the subType without results.</p>
  
  <p>My only guess is that I am doing something wrong with the mapper, but I can't find anything on the subject since most of the people seem to either don't want the type information to show up in the json string, or to have problems with the deserialization process.</p>