リストを持つエンティティがあります。
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name = "subject_group_join",
joinColumns = {
@JoinColumn(name="sub_group_id")
},
inverseJoinColumns = {
@JoinColumn(name="subject_id")
}
)
List<SubjectEntity> listOfSubjects;
Subject エンティティは次のとおりです。
@Entity
@Table(name="subject_details")
@NamedNativeQueries({
@NamedNativeQuery(name = "GET_SUBJECT_BY_CLASS",query = "call fetchAllSubjectByClass(:classId,:sessionId)",resultClass = SubjectEntity.class) ,
@NamedNativeQuery(name = "GET_OPTIONAL_SUBJECT_BY_CLASS",query = "call fetchOptionalSubjectByClass(:classId,:sessionId)",resultClass = SubjectEntity.class),
@NamedNativeQuery(name = "GET_CUMPULSORY_SUBJECT_BY_CLASS_NOT_GROUPED",query = "call fetchAllCumpulsorySubjectByClassNotGrouped(:classId,:sessionId)",resultClass = SubjectEntity.class),
@NamedNativeQuery(name = "GET_OPTIONAL_SUBJECT_BY_CLASS_NOT_GROUPED",query = "call fetchAllOptionalSubjectByClassNotGrouped(:classId,:sessionId)",resultClass = SubjectEntity.class),
})
public class SubjectEntity extends AbstractEntity{
private static final long serialVersionUID = 7320078093064615396L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="subject_id")
private long subjectId;
@Column(name="subject_name",length=32)
private String subjectName;
@Column(name="subject_code",length=32)
private String subjectCode;
@Column(name="description",length=512)
private String description;
@Column(name="subject_status")
private boolean subjectStatus;
「entity1から」Hqlで最初のエンティティリストを取得したとき。subjectEntity に入力されたすべてのデータが表示されるわけではなく、id が含まれているだけです。