title: How to Generate an auto UUID using Hibernate on spring boot
body: <p>What I am trying to achieve is generate a UUID which is automatically assigned during a DB Insert. Similar to the primary key column named "id" generating an id value. </p>
  
  <p>The model values looks something like this:</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  @Column(nullable = false)
  private Long id;
  
  
  @GeneratedValue(generator = "uuid2")
  @GenericGenerator(name = "uuid2", strategy = "uuid2")
  @Column(name = "uuid", columnDefinition = "BINARY(16)")
  private UUID uuid;
  </code></pre>
  
  <p>But when the DB insert is done. the "uuid" is empty. </p>
  
  <p>Help is greatly appreciated. And if I am asking an obvious stupid question I am sorry.</p>