I can\'t get Hibernate working with java.util.UUID for PostgreSQL.
Here is the mapping using javax.persistence.* annotations:
private UUID itemUuid;
Now you can also use the UUID class provided by java.util.UUID which gets mapped to uuid datatype of Postgres by Hibernate without any conversions required while reading/writing from the database.
@Id
@GeneratedValue
private UUID id;
The generated value is auto by default this lets your JVM define the UUID. This also allows hibernate to use the batch insert optimisation.
You can configure the database to set the UUID value. More information can be found here https://vladmihalcea.com/uuid-identifier-jpa-hibernate/