Reputation: 171
i generate UUID like this
@Id
@GeneratedValue(generator="hibernate-uuid")
@GenericGenerator(name="hibernate-uuid", strategy = "uuid")
@Column(name="id", unique = true, length=36)
private String id;
but i still haven't found a way to add prefix to generated UUID (or to generate UUID with added prefix).
if i use getter method to add a prefix, actual UUID is still UUID without prefix. appreciate the help.
Upvotes: 1
Views: 1461
Reputation: 171
i found an answer. maybe not straight-forward, but you can implement hibernate.id.IdentifierGenerator and create your own custom id generator class.
Upvotes: 1