我想在我的实体中有一个不持久的可查询集合。换句话说,一个短暂的多对多关系。我努力了:
@Transient
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name="QuestionSetClass_Link", schema = "SVY",
joinColumns={@JoinColumn(name="QuestionSetID", referencedColumnName="QuestionSetID")},
inverseJoinColumns={@JoinColumn(name="QuestionSetClassID", referencedColumnName="ID")})
private Collection<QuestionSetClass> questionSetClasses;
public Collection<QuestionSetClass> getQuestionSetClasses(){
return questionSetClasses;
}
public void setQuestionSetClasses(Collection<QuestionSetClass> questionSetClasses){
this.questionSetClasses = questionSetClasses;
}
但是 EclipseLink 不会部署它并给我以下错误:映射注释不能应用于指定了 @Transient 的字段或属性。[字段 questionSetClasses] 违反了此限制。
谁能告诉我处理这个问题的最佳方法?