title: JAXB annotations are ignored ( @XmlAccessorType(XmlAccessType.NONE) and @XmlTransient
body: <p>I have two simple Classes:</p>
  
  <pre><code>import javax.xml.bind.annotation.*;
  
  @XmlRootElement(name="address")
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Address {
  
      @XmlElement(required=true) 
      protected int number;
  
      @XmlElement(required=true)  
      protected String street;
  
      @XmlTransient
      protected String city;
  
      public Address() { }
  
      public int getNumber() {
          return number;
      }
  
      public void setNumber(int number) {
          this.number = number;
      }
  
      public String getStreet() {
          return street;
      }
  
      public void setStreet(String street) {
          this.street = street;
      }
  
      @XmlTransient
      public String getCity() {
          return city;
      }
  
      public void setCity(String city) {
          this.city = city;
      }
  }
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>import javax.xml.bind.annotation.*;
  
  @XmlRootElement(name="customer")
  @XmlAccessorType(XmlAccessType.NONE)
  public class Customer {
  
      @XmlAttribute(required=true) 
      protected int id;
  
      @XmlElement(required=true) 
      protected String firstname;
  
      @XmlElement(required=true) 
      protected String lastname;
  
      @XmlTransient
      protected Address address;
  
      public Customer() { }
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public String getFirstname() {
          return firstname;
      }
  
      public void setFirstname(String firstname) {
          this.firstname = firstname;
      }
  
      public String getLastname() {
          return lastname;
      }
  
      public void setLastname(String lastName) {
          this.lastname = lastName;
      }
  
      @XmlTransient
      public Address getAddress() {
          return address;
      }
  
      public void setAddress(Address address) {
          this.address = address;
      }
  }
  </code></pre>
  
  <p>resource method:</p>
  
  <pre><code>@GET
  @Path("{id}")
  @Produces({"application/json"})
  public Customer getCustomer(@PathParam("id") String id) {
      Customer customer = null;
      try {
          customer = JpaEmu.findById(id);
      } catch (Exception ex) {
          ex.printStackTrace();
      }
      return customer;   // null = 204
  }
  </code></pre>
  
  <p>I want the JSON object not to contain address, however GET request returns:</p>
  
  <pre><code>{"id":1,"firstname":"Duke2","lastname":"NukEm","address":{"number":23,"street":"Hollywood Holocaust","city":"L.A."}}
  </code></pre>
  
  <p>Running with: Jboss7, my only dependencies are: </p>
  
  <p>jboss-javaee-6.0
    3.0.2.Final</p>
  
  <pre><code>web.xml:
  
  &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
           version="3.0"&gt;
  
    &lt;servlet&gt;
      &lt;servlet-name&gt;javax.ws.rs.core.Application&lt;/servlet-name&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;javax.ws.rs.core.Application&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>It seems that JAXB annotations are not taking part in the process of parsing to JSON, especially: @XmlTransient &amp; @XmlAccessorType(XmlAccessType.NONE) are compeltly ignored.</p>