title: How to use a java class as a entity and also as a model
body: <p>I have a entity class "classA" and a model class "ClassA1". ClassA is used to store the values in mysql database from server side and ClassA1 is used to convert a API response string into object which is client side.</p>
  
  <p>Now I am having two java classes with same getters and setters but ClassA contains hibernate annotations and ClassA1 is simply a POJO. Consider the following class structures</p>
  
  <p><strong>ClassA.java</strong></p>
  
  <pre><code>@Entity
  @Table(name="classA")
  public class ClassA {
      @Id
      private int id;
      private String name;
  
      public int getId() {
          return id
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      @Column(name="name")
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p><strong>ClassA1.java</strong></p>
  
  <pre><code>public class ClassA1 {
      private int id;
      private String name;
  
      public int getId() {
          return id
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>My application is containg more number of classes like the above. I want to avoid this, because If I add any column to my database, currently I am adding getters and setters in both ClassA and also in ClassA1.</p>
  
  <p>Is there any way to use a single class for both server and client side modules?</p>