I have the main entity class with the below fields where there is a field finid which references patient entity class. :-
public class Patientrel implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "patientrelid")
private Long patientrelid;
@Column(name = "entrydate")
@Temporal(TemporalType.TIMESTAMP)
private Date entrydate;
@JoinColumn(name = "finid", referencedColumnName = "fin_id")
@ManyToOne
private Patient finid;
Entity class of Patient :-
public class Patient implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "fin_id")
private Integer finId;
@Size(max = 100)
@Column(name = "patient_name")
private String patientName;
@OneToMany(mappedBy = "finid")
private Collection<Patientrel> patientrelCollection;
Now i need to search patientrel matching a given finid. Can anyone please share the approach for that?