我使用 Hibernate 作为 JPA 提供程序。我有例如这个类:
@Question("multipleChoiceQuestion")
@Entity
public class MultipleChoiceQuestion extends QuestionUnit {
private ArrayList<String> questionContent;
public MultipleChoiceQuestion() {
this(null, null);
}
public MultipleChoiceQuestion(ArrayList<String> questionContent,
AnswerUnit correctAnswer) {
super(correctAnswer);
this.questionContent = questionContent;
}
public ArrayList<String> getQuestionContent() {
return this.questionContent;
}
}
如果我坚持它,该questionContent
属性将保存为 blob。我知道我可以使用ElementCollection
注释为我的 ArrayList 的内容创建单独的表。
我想知道这种行为(将作为属性的集合保存为 blob)是在 JPA 规范中的某处指定的,还是特定于 Hibernate 的?