title: Remove Duplicate entry '59' for key 'PRIMARY in Hibernate
body: <p>I am very new in Hibernate. I am using Hibernate with JPA. I have an annotated entity class and a table related to that entity class.</p>
  
  <pre><code>@Entity 
  public class Test implements Serializable { 
      @Id
      @GenericGenerator(name="inc" , strategy="identity")
      @GeneratedValue(generator="inc") 
      private int id; 
  
      private String address; // setter getter and constructor 
  }
  </code></pre>
  
  <p>When saving this entity, it insert the data into the db. But during application running process another application is inserting data into same table. when my application try to save the data then Duplicate entry '59' for key 'PRIMARY' exception generated. So I want to use a generator which can insert the data and generate id in database level rather than application level and the identifier must saved back to my entity.</p>