title: Get generated entity Id before persisting, Hibernate, Spring data
body: <p>Some preconditions: </p>
  
  <p>I am not using Oracle DB sequence generator. Instead of it, I rely on the Hibernate sequence generator e.x.</p>
  
  <pre><code>@Entity
  @Table(name = "JPA_ENTITY_A")
  @GenericGenerator(name = "system-uuid", strategy = "uuid2")
  public class JpaEntityA{
      @Id
      @Type(type = "uuid-binary")
      @GeneratedValue(generator = "system-uuid")
      private UUID id;
      @Column(name="NAME_WITH_ID")
      String nameWithGeneratedId;
  }
  </code></pre>
  
  <p>What I want is to persist the following generated value into the column "NAME_WITH_ID": <code>this.nameWithGeneratedId+this.id</code></p>
  
  <p>Is it feasible to do the following:</p>
  
  <pre><code>public String getNameWithGeneratedId(){
      return this.nameWithGeneratedId+this.id;//hope that the returned value will be persisted
  }
  </code></pre>
  
  <p>Or is it possible to retrieve in advance before persisting entity to the DB generated id? If yes, then how can I accomplish it? (based on the comments below it is not possible to do it)</p>
  
  <p>Thx in advance. </p>