我有一个问题(我不确定是否可能)使用 JPA 关联和嵌入 id ......
我有一Person
堂课,它的 id:
@Entity
public class Person{
@EmbeddedId
private PersonCode personCode;
private String name;
@Embeddable
public static class PersonCode{
private String code;
}
}
然后我想创建一个Company
具有关联的类:
@Entity
public class Company{
private String name;
@OneToMany
private List<PersonCode> employees;
}
但我有这个例外:
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: example.domain.Company.employees[example.domain.Person$PersonCode]