title: Is there a way to use Postgres' UUID generation with Hibernate's IDENTITY ID generation strategy?
body: <p>I'm using Spring Boot 1.4.1, which includes Hibernate 5, with Postgres 9.6, and I'm trying to create an entity with a UUID ID but using Postgres' UUID generation instead of Hibernate's. Many similar questions say to set the column type as <code>pg-uuid</code>. That seems to work for non-database-generated ID columns, but when I try to use it for the ID column I get </p>
  
  <p><code>org.hibernate.id.IdentifierGenerationException: unrecognized id type : pg-uuid -&gt; java.util.UUID</code></p>
  
  <p>So it looks like Hibernate is applying the type correctly, but not converting it.</p>
  
  <p>Here is how the ID column of my entity is setup:</p>
  
  <pre><code>@Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @org.hibernate.annotations.Type(type="pg-uuid")
  private UUID id;
  </code></pre>
  
  <p>And the table is setup similar to as follows (<code>uuid-ossp</code> is installed)</p>
  
  <pre><code>create table example (
      id UUID NOT NULL DEFAULT uuid_generate_v1mc(),
      ...
  );
  </code></pre>
  
  <p>I would prefer to have the database generate the UUIDs and don't want to use Hibernate's generation strategies. Is there a way to get this to work?</p>