我将从@Embeddable Class Certification 中选择所有列。但我无法选择它。我该如何选择 Embeddable 类。
@Entity
public class Department implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
@ElementCollection
@CollectionTable(name = "Certification", joinColumns = {@JoinColumn(name="user_id")})
private List<Certification> certifications = new ArrayList<Certification>();
public List<Certification> getCertifications() {
return certifications;
}
public void setCertifications(List<Certification> certifications) {
this.certifications = certifications;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
.....
@Embeddable 类认证
@Embeddable
public class Certification{
private String name;
private String certArt;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCertArt() {
return certArt;
}
public void setCertArt(String certArt) {
this.certArt = certArt;
}
......
如果我运行 ResultService 我得到以下异常:
原因:java.lang.IllegalArgumentException:在 EntityManager 中创建查询时发生异常:异常描述:编译查询时出错 [从认证 c 中选择 c]。未知的实体类型 [Certification]。
我如何选择@Embeddable 类?