I have two Pojo's Club and Team both has common table column called clubId, then i need to get records from the both the table when Club.clubId equals Team.clubId.
Could anyone help me to do check the equals based on the id's of two Pojos
I have both the POJO's with Relationship defined over there as like below
Club POJO:
public class Club implements Serializable,Comparable{
@Id
@GeneratedValue
@Column(name = "clubId")
private Integer clubId;
@Column(name="name")
private String name;
@OneToMany(fetch = FetchType.EAGER,mappedBy = "club")
private Set<Team> team=new HashSet<Team>(0);
For Team:
@Entity
@Table(name="team")
public class Team implements Serializable{
@Id
@GeneratedValue
@Column(name="teamid")
private Integer teamId;
@Column(name="teamname")
private String teamName;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "clubid", nullable = false, insertable = false, updatable = false)
private Club club
;