title: @JsonIgnore and @JsonBackReference are being Ignored
body: <p>I'm working with RestEasy, Jboss 7 and EJB 3.1. I'm creating a RESTful web service that returns data in JSON format.</p>
  
  <p>The problem is that I have a <code>@ManyToOne</code> relationship on one of my entities which causes an infinite recursion during serialization. I tried using Jackson's <code>@JsonIgnore</code> and <code>@JsonBackReference</code> annotations to fix the problem but it seems as if they are being totally ignored and the infinite recursion is still occurring.</p>
  
  <p>This is my User Class:</p>
  
  <pre><code>class User {
      private String userId;
      private Role role;
  
      @Id
      @Column(name = "\"UserId\"", unique = true, nullable = false, length = 30)
      public String getUserId() {
          return this.UserId;
      }
  
      public void setUserId(String UserId) {
          this.UserId = UserId;
      }
  
      @ManyToOne(fetch = FetchType.EAGER)
      @JoinColumn(name = "\"RoleId\"", nullable = false)
      //I have tried @JsonIgnore without @JsonBackReference 
      @JsonIgnore
      //I have tried @JsonBackReference without @JsonIgnore 
      //Also I have tried @JsonBackReference and @JsonIgnore together
      @JsonBackReference("role-User")
      public Role getRole() {
          return this.role;
      }
  }
  </code></pre>
  
  <p>This is a part of my Role Class:</p>
  
  <pre><code>@JsonManagedReference("role-User")
  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "role")
  public Set&lt;User&gt; getUsers() {
      return this.users;
  }
  </code></pre>
  
  <p>I have read somewhere that I should register Jackson with my application to be able to use regular Jaxb annotation so I created a class </p>
  
  <pre><code>@Provider
  @Produces(MediaType.APPLICATION_JSON)
  public class JacksonContextResolver implements ContextResolver&lt;ObjectMapper&gt; {
      public JacksonContextResolver() {
          ObjectMapper mapper = new ObjectMapper();
          AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();
  
          mapper.getDeserializationConfig().setAnnotationIntrospector(
                  introspector);
          mapper.getSerializationConfig().setAnnotationIntrospector(introspector);
      }
  
      public ObjectMapper getContext(Class&lt;?&gt; objectType) {
          return objectMapper;
      }
  }
  </code></pre>
  
  <p>The problem with the above being that <code>JaxbAnnotationIntrospector()</code> is deprecated.</p>
  
  <p>Please:</p>
  
  <ul>
  <li>Do you have any idea why the Jackson annotations are being ignored?</li>
  <li>How can I use the regular JAXB XML annotations instead of Jackson's?</li>
  <li>What can I use instead of <code>JaxbAnnotationIntrospector()</code>?</li>
  </ul>
  
  <p>An answer to any of these question is appreciated, thanks.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>For now I have excluded <code>resteasy-jackson-provider</code> using <code>jboss-deployment-structure.xml</code> and I am using Jettison instead. I still want to know how could I use Jackson!</p>