title: Jackson Jaxb Annotation Precedence - @JsonProperty overriding @XmlTransient
body: <p>I am using Jackson (2.1.1) for JSON serialization/deserialization. I have an existing class with JAXB annotations. Most of these annotations are correct and can be used as-is with jackson. I am using mix-ins to slightly alter the deserialization/serialization of these classes. </p>
  
  <p>In my ObjectMapper constructor I do the following:</p>
  
  <pre><code>setAnnotationIntrospector(AnnotationIntrospector.pair(
                   new JacksonAnnotationIntrospector(), 
                   new JaxbAnnotationIntrospector(getTypeFactory())));
  </code></pre>
  
  <p>Based on the above, the Jackson annotations have precedence over Jaxb, because of the order of the introspectors. This is based on the Jackson Jaxb <a href="http://wiki.fasterxml.com/JacksonJAXBAnnotations" rel="noreferrer">docs</a>. For fields that I want ignored, adding <code>@JsonIgnore</code> to the field in the mix-in is working fine. There are a couple of fields that are marked as <code>@XmlTransient</code> in the existing classes that I do not want ignored. I have tried add <code>@JsonProperty</code> to the field in the mix-in, but it doesn't seem to work.</p>
  
  <p>Here is the original class:</p>
  
  <pre><code>public class Foo {
      @XmlTransient public String getBar() {...}
      public String getBaz() {...}
  }
  </code></pre>
  
  <p>Here is the mix-in:</p>
  
  <pre><code>public interface FooMixIn {
      @JsonIgnore String getBaz(); //ignore the baz property
      @JsonProperty String getBar(); //override @XmlTransient with @JsonProperty
  }
  </code></pre>
  
  <p>Any idea how to resolve this without modifying the original class?</p>
  
  <p>I also tested adding @JsonProperty to the members instead of using mix-ins:</p>
  
  <pre><code>public class Foo {
      @JsonProperty @XmlTransient public String getBar() {...}
      @JsonIgnore public String getBaz() {...}
  }
  </code></pre>
  
  <p>I seem to get the same behavior as I did with the mix-in. Unless @XmlTransient is removed, the property is ignored.</p>