title: Spring Not sending all fields in JSON response
body: <p>MY POJO:    </p>
  
  <pre><code>import java.io.Serializable;
  
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.IdClass;
  import javax.persistence.Table;
  
  import lombok.Data;
  
  
  @Entity
  @Table(name="user_linked_email")
  @IdClass(UserLinkedEmailKey.class)
  @Data
  public class UserLinkedEmail implements Serializable {
  
  
      /**
       * serialVersionUID
       */
      private static final long serialVersionUID = 1L;
  
      @Id
      private Integer userId;
      @Id
      private String linkedEmail;
  
  
      /**
       * The Following are appearing in JSON response
       */
      private boolean status;
  
      private boolean preferredFlag;
  
  }
  </code></pre>
  
  <p>UserLinkedEmailKey class:</p>
  
  <pre><code>public class UserLinkedEmailKey implements Serializable {
      /**
       * serialVersionUID
       */
      private static final long serialVersionUID = 1L;
  
      private Integer userId;
      private String linkedEmail;
  }
  </code></pre>
  
  <p>And My Controller Snippet:</p>
  
  <pre><code>public org.springframework.http.ResponseEntity&lt;?&gt; getLinkedEmails(@PathVariable(value = "userId") Integer zepoUserId) {
  
  
          try {
              List&lt;UserLinkedEmail&gt; linkedEmails = userService.getLinkedEmails(zepoUserId);
  
  
              //linkedEmails till this point has all 4 fields
  
              return new ResponseEntity&lt;List&lt;UserLinkedEmail&gt;&gt;(linkedEmails, HttpStatus.OK);
  
          } catch (Exception e) {
              //
          }
  </code></pre>
  
  <p>Response in JSON is as follows:</p>
  
  <pre><code>[
    {
      "status": false,
      "preferredFlag": true
    },
    {
      "status": true,
      "preferredFlag": false
    },
    {
      "status": true,
      "preferredFlag": false
    }
  ]
  </code></pre>
  
  <p>Why are the other two fields i.e userId and linkedEmail not showing up in response although Spring-Data JPA is returning the entire object from the repository?</p>