title: Java : Convert Jackson (JSON) class to Entity (JPA) Class
body: <blockquote>
    <p>I have two classes that have same fields. However, one is for the JSON
    and the another is for the JPA Entity. I want to convert the JSON
    object (Student) into the JPA Entity (StudentEntity). I tried to parse
    the JSON class into the JPA Class, however it didn't allow. How can convert the (Student) Json class into (StudentEntity) class so that information I have in the JSON class can be used to persist in the database from JPA Entity Class?</p>
  </blockquote>
  
  <pre><code>package com.student.entity;
  
  import java.io.Serializable;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table(name = "Student")
  public class StudentEntity implements Serializable {
      private static final long serialVersionUID = 1L;
      @Id
      @Column(nullable = false, updatable = false)
      @GeneratedValue
      private long studentID;
  
      private String fName;
      private String lName;
  
      private Address address;
  
      public long getStudentID() {
          return studentID;
      }
  
      public void setStudentID(long studentID) {
          this.studentID = studentID;
      }
  
      public String getfName() {
          return fName;
      }
  
      public void setfName(String fName) {
          this.fName = fName;
      }
  
      public String getlName() {
          return lName;
      }
  
      public void setlName(String lName) {
          this.lName = lName;
      }
  
      public Address getAddress() {
          return address;
      }
  
      public void setAddress(Address address) {
          this.address = address;
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>package com.ejb.objectmapper.entity.student;
  
  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import com.fasterxml.jackson.annotation.JsonProperty;
  
  @JsonIgnoreProperties("studentID")
  public class Student {
      private long studentID;
      @JsonProperty
      private String fName;
      @JsonProperty
      private String lName;
  
      private Address address;
  
      public long getStudentID() {
          return studentID;
      }
  
      public void setStudentID(long studentID) {
          this.studentID = studentID;
      }
  
      public String getfName() {
          return fName;
      }
  
      public void setfName(String fName) {
          this.fName = fName;
      }
  
      public String getlName() {
          return lName;
      }
  
      public void setlName(String lName) {
          this.lName = lName;
      }
  
      public Address getAddress() {
          return address;
      }
  
      public void setAddress(Address address) {
          this.address = address;
      }
  }
  </code></pre>