title: Storing UUID as string in mysql using JPA
body: <p>I came across a blog of using UUID with Hibernate and MySql. Now the problem is, whenever I take a look at the database the ID's will be non-readable format (binary-16). How can I store UUID as a readable format like <code>7feb24af-fc38-44de-bc38-04defc3804fe</code> instead of <code>¡7ôáßEN¹º}ÅÑs</code></p>
  
  <p>I was using this code </p>
  
  <pre><code>@Id
  @GeneratedValue( generator = "uuid2" )
  @GenericGenerator( name = "uuid2", strategy = "uuid2" )
  @Column( name = "id", columnDefinition = "BINARY(16)" )
  private UUID id;
  </code></pre>
  
  <p>And the result is <strong>¡7ôáßEN¹º}ÅÑs</strong>. But I want it as readable UUID so I used the following code which didn't help me</p>
  
  <pre><code>@Id
  @GeneratedValue( generator = "uuid2" )
  @GenericGenerator( name = "uuid2", strategy = "uuid2" )
  @Column( name = "id", columnDefinition = "CHAR(32)" )
  private UUID id;
  </code></pre>
  
  <p>How to save the UUID as a string instead of binary(16) without changing the java type UUID</p>