title: Spring with Hibernate: Duplicate entry for key 'PRIMARY'
body: <p>I have developed a REST- API with Spring Web and Hibernate. 
  I deployed it in two server instances and it runs without any problem for about 5 months. Now it is mostly working but in some periods "<strong>MySQLIntegrityConstraintViolationException</strong>" with message "<strong>Duplicate entry '235648' for key 'PRIMARY'</strong>" are thrown (te duplicate id is changing in the exceptions).</p>
  
  <p>The class, for which the exception is thrown, looks like this:</p>
  
  <pre><code>@Entity
  @Table(name = "Metadata", catalog = "data")
  public class Metadata{
      private Long id;
      private String field1;  
      private String field2;
      //...           
  
      @Id
      @Column(unique = true, nullable = false)
      @GeneratedValue(strategy = GenerationType.TABLE)
      public Long getId() {
          return id;
      }
      //More Getters and Setters...
  }
  </code></pre>
  
  <p>There was neither change to java code nor changes on the MySql-database.
  Do you have any idea why it stopped working properly?</p>