title: How to generate UUID using spring annotations
body: <p>I want to generate UUID in spring controller.
  I am new to this and I was exploring following </p>
  
  <pre><code>@GeneratedValue(generator = "uuid")
  @GenericGenerator(name = "uuid", strategy = "uuid2")
  private String corrId;
  </code></pre>
  
  <p>I do not want to associate this uuid with any database column/field but want it to be unique(I am not sure if this is possible)</p>
  
  <p>When I try to print value of String 'corrId', it always gives me null</p>
  
  <p>I have also tried but value of corrId is still null</p>
  
  <pre><code>@Id
  @GeneratedValue(generator = "uuid")
  @GenericGenerator(name = "uuid", strategy = "uuid2")
  private String corrId;
  </code></pre>
  
  <p>Am I doing something wrong here or my approach is completely wrong.</p>
  
  <p>Thanks in advance!</p>