title: Jackson JSON Provider ignoring @JsonIgnore
body: <p>I have a JAX-RS service for accessing some data. There are links to other classes, which I annotate with <code>@JsonIgnore</code>. Now, the Jackson provider is ignoring those annotations.</p>
  
  <p>My Object:</p>
  
  <pre><code>@Entity
  @Table(name = "documents")
  @XmlRootElement
  public class Document implements Serializable {
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Basic(optional = false)
      @Column(name = "id")
      private Integer id;
      @Basic(optional = false)
      @NotNull
      @Size(min = 1, max = 10)
      @Column(name = "version")
      private String version;
      @Basic(optional = false)
      @NotNull
      @Size(min = 1, max = 35)
      @Column(name = "document_number")
      private String documentNumber;
      @Basic(optional = false)
      @NotNull
      @Column(name = "document_date")
      @Temporal(TemporalType.TIMESTAMP)
      private Date documentDate;
      @OneToMany(cascade = CascadeType.ALL, mappedBy = "subDocument", fetch = FetchType.LAZY)
      private List&lt;SubDocument&gt; subDocumentList;
  
      public Document() {
      }
  
      public Document(Integer id) {
          this.id = id;
      }
  
      public Document(Integer id, String version, String documentNumber, Date documentDate) {
          this.id = id;
          this.version = version;
          this.documentNumber = documentNumber;
          this.documentDate = documentDate;
      }
  
      @XmlAttribute(required = false)
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      @XmlAttribute(required = true)
      public String getVersion() {
          return version;
      }
  
      public void setVersion(String version) {
          this.version = version;
      }
  
      @XmlAttribute(required = true)
      public String getDocumentNumber() {
          return documentNumber;
      }
  
      public void setDocumentNumber(String documentNumber) {
          this.documentNumber = documentNumber;
      }
  
      @JsonSerialize(using = JsonDateSerializer.class)
      @XmlAttribute(required = true)
      public Date getDocumentDate() {
          return documentDate;
      }
  
      @JsonDeserialize(using = JsonDateDeserializer.class)
      public void setDocumentDate(Date documentDate) {
          this.documentDate = documentDate;
      }
  
      @JsonIgnore
      public List&lt;SubDocument&gt; getSubDocumentList() {
          return subDocumentList;
      }
  
      public void setSubDocumentList(List&lt;SubDocument&gt; subDocumentList) {
          this.subDocumentList = subDocumentList;
      }
  }
  </code></pre>
  
  <p>The REST ApplicationConfig</p>
  
  <pre><code>@Override
  public Set&lt;Class&lt;?&gt;&gt; getClasses() {
      Set&lt;Class&lt;?&gt;&gt; resources = new java.util.HashSet&lt;&gt;();
      try {
          Class jacksonProvider = Class.forName("org.codehaus.jackson.jaxrs.JacksonJsonProvider");
          resources.add(jacksonProvider);
      } catch(ClassNotFoundException ex) {
          SLOGGER.fatal("could not find class JacksonJsonProvider", ex);
      }
      addMyOtherResourceClasses(resources);
      return resources;
  }
  </code></pre>
  
  <p>And the REST Interface:</p>
  
  <pre><code>@GET
  @Consumes(MediaType.TEXT_PLAIN)
  @Produces(MediaType.APPLICATION_JSON)
  @Path("getDocumentById/{id}")
  public Document getDocumentById(@PathParam("id") String id) {
      return sbDocuments.getDocumentById(id);
  }
  </code></pre>
  
  <p>So, even though the <code>@JsonIgnore</code> annotation is present on my document, the list does get mapped to the output. It does work with the <code>@XmlTransient</code> annotation, but since JAXB get's used aswell, I can't add that annotation.</p>
  
  <p>I use the Codehaus implementation, but I've tried FasterXML aswell, both the same result. What should I do to fix this? Service is running on a Glassfish 4.1 server.</p>