I\'m using hibernate with spring, h2 and liquibase and I\'m trying to make a custom String id generator for my entities by taking example with this blog post but I\'m gettin
Yes, hibernate have prebuilt String generators. Just substitute your @GenericGenerator definition to another strategy.
@Entity
@Table(name = "contact")
public class Contact implements Serializable, Identifiable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
For more information about different hibernate generators you can look at documentation.