title: Hibernate is getting wrong ID values when using UUID as primary key
body: <p>My entity:</p>
  
  <pre><code>@Entity
  @Table(name = "eh_portal")
  public class PortalEntity {
  
      @Id
      @Column(name = "id", columnDefinition = "CHAR(36)")
      private UUID id; //java.util.UUID;
  
      @Column(name = "name")
      private String name;
  
      @Column(name = "url")
      private String url;
  
      // -- Constructor for Hibernate --
      protected PortalEntity() {
      }
  
      // -- Constructor for new entity in service code --
      public PortalEntity(final UUID id) {
          this.id = id;
      }
      .... getters and setters ommited
  }
  </code></pre>
  
  <p>Respository is Spring DATA JPA:</p>
  
  <pre><code>public interface PortalRepository extends CrudRepository&lt;PortalEntity, UUID&gt; {
  
  }
  </code></pre>
  
  <p>MYSQL 5 Database table definition:</p>
  
  <pre><code>CREATE TABLE `eh_portal` (
    `id` char(36) NOT NULL COMMENT 'UUID',
    `name` varchar(255) NOT NULL,
    `url` varchar(255) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `url_UNIQUE` (`url`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8
  </code></pre>
  
  <p>The problem is, Hibernate is returning obviously wrong data - see screenshots below
  Mysql workbench:</p>
  
  <p><a href="https://i.stack.imgur.com/9bFuy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9bFuy.png" alt="enter image description here"></a></p>
  
  <p>Actual web page where I get entities thru Spring Data JPA:
  <a href="https://i.stack.imgur.com/7dEYO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7dEYO.png" alt="enter image description here"></a></p>
  
  <p>You can see that UUIDs are obviously differrent, while other columns are correct. 
  What is wrong here? (Spring 4, Hibernate 4, Spring DATA JPA, Mysql 5)</p>