title: JPA auto increment mapping's value column
body: <p>I would like to create a mapping service using JPA. The mapping is simple, I have one key (String) for one value (Long). The keys are computed values (so it cannot be autogenerated) and are unique. The only operations that will be executed is findById(String key) and save(MyMapping mapping).
  What I want is, when I save a new mapping, I just need to give the key, and the value would be autogenerated using autoincrement.</p>
  <p>What is the best way to implement this ? Is there a <em>@GeneratedValue</em> for value columns?</p>
  <p>JPA version : <em>jakarta.persistence:jakarta.persistence-api:2.2.3</em></p>
  <p>My mapping entity :</p>
  <pre><code>@Entity
  public class MyMapping {
      @Id
      String key;
  
      Long value; // must be unique and autoincremented value
  }
  </code></pre>