@MappedSuperclass
public class BaseEntity implements Serializable {
@Id
@Column(name = "ID", unique = true)
@Size(min = 1, max = 255)
private String id;
@PrePersist
public final void generateUuid() {
if (this.getId() == null) {
this.setId(UUID.randomUUID().toString());
}
}
public final String getId() {
return id;
}
public final void setId(final String id) {
this.id = id;
}
}