我的Entities
如下...
@Entity
@Table(name = "PROJECT")
public class CProject implements Serializable {
@Id
private Long id;
@OneToOne(fetch = FetchType.LAZY)
@Fetch(FetchMode.SELECT)
@JoinColumn(name = "TEAM")
private Team team;
}
还有
@Entity
@Table(name = "TEAM")
public class Team implements Serializable {
@Id
private Long id;
private Date formedDate;
@ElementCollection(fetch = FetchType.EAGER)
@MapKeyColumn(name = "MEM_ID")
@Column(name = "WEIGHTAGE")
@CollectionTable(name = "TEAM_MEMBERS")
private Map<Long, Integer> teamMembers = new HashMap<>();
}
我还有一个名为Entity
的{{1}}。与Member
有关的某些成员。这些成员由Team
我想通过他/他们的private Map<Long, Integer> teamMembers;
获得Project
参与团队成员的名单。目前我正在使用Long id
请注意:Map Key中使用的TeamMember ID,例如DetachedCriteria / Criteria
。