title: Jackson: Customizing resolving of ObjectIds (from @JsonIdentityInfo)
body: <p>In my Spring WebMVC application, I'm trying to deserialize a list of object references.</p>
  
  <p>Here is what my model field looks like:</p>
  
  <pre><code>@Entity
  @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
  public class Article {
      @Id
      private Integer id;
  
      @ManyToMany(cascade=CascadeType.ALL)
      @JsonIdentityReference(alwaysAsId=true)
      private List&lt;Article&gt; related;
  }
  </code></pre>
  
  <p>Whenever I try to deserialize a JSON-Object, I get the following debugging message:</p>
  
  <blockquote>
    <p>com.fasterxml.jackson.databind.JsonMappingException: Could not resolve
    Object Id [351] (for [simple type, class
    com.company.package.domain.Article]) -- unresolved
    forward-reference? (through reference chain:
    com.company.package.domain.Article["related"])</p>
  </blockquote>
  
  <p>The object looks like this:</p>
  
  <pre><code>{ 
    "id": 123,
    "related": [351]
  }
  </code></pre>
  
  <p>I've tried writing my custom deserializer to deal with this, but as the relationship is to an object of the same class, Jackson will try to deserialize the parent object with the custom deserializer as well, which will obviously fail since it's not just an integer......</p>
  
  <p>So is there a way to tell Jackson to use the database to lookup the objects behind the IDs?</p>