I have an embeddable collection and i want to have a auto-generated UUID field in it. I am using hibernate ogm with mongoDB. I am trying the following code but it results in the following exception:
@Embeddable
public class Attachment {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name="uuid", strategy="uuid2")
private String attachmentId;
Exception:
Caused by: org.hibernate.annotations.common.AssertionFailure: Declaring class is not found in the inheritance state hierarchy: com.xxx.yyy.zzz.model.Attachment
if I remove this id field, everything works fine except that my embedded document have no id in it. Any thoughts?