title: Creating Object with JSON Post request
body: <p>I'm creating a Rest API with JAX-RS (Jersey) and Jackson to handle the JSON objects. I want to let the user create a Brand object by seeing a post request with a son body that only some of the fields of the brand POJO is filled in. </p>
  
  <p>This is my Brand entity:</p>
  
  <pre><code>@Data
  @Entity
  @NoArgsConstructor
  public class Brand {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private long id;
      private String name;
      private int founded;
      private String founder;
      private String ceo;
      private String headQuarters;
  
  
      private Date created;
      private Date updated;
  
  
      @Transient
      private List&lt;Link&gt; links = new ArrayList&lt;&gt;();
  
      public Brand(String name){
          this.name = name;
      }
  
      public void addLink(String href, String rel, String action){
          Link link = new Link(href, rel, action);
          links.add(link);
      }
  
      @PrePersist
      protected void onCreate() {
          created = new Date();
      }
  
      @PreUpdate
      protected void onUpdate() {
          updated = new Date();
      }
  
  }
  </code></pre>
  
  <p>If a user would send the following JSON body:</p>
  
  <pre><code>{
      name:"brand-name",
      founded:1974
  }
  </code></pre>
  
  <p>I want a new Brand object with the only these two values, created and the id to be set, the rest should be null. Is there a way for me to create a new Object with these values when the JSON is unmarshalling? Or do I have to take it in as a JsonObject and then check which values are specified to then create a new object with them?</p>