Depending on what exactly you want, this should work just like this:
@Entity public class MyEntity { @Id @GeneratedValue( generator = "entityIdGenerator" ) @GenericGenerator( name = "entityIdGenerator", strategy = "uuid2" ) @Column( columnDefinition = "uuid", updatable = false ) public UUID getId() { return id; } }
Or even more succinctly, in conjunction with the fix for
@Entity public class MyEntity { @Id @GeneratedValue @Column( columnDefinition = "uuid", updatable = false ) public UUID getId() { return id; } }