我的主要实体类具有以下字段,其中有一个引用患者实体类的字段 finid。:-
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;
患者的实体类:-
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;
现在我需要搜索与给定 finid 匹配的患者关系。谁能分享一下这个方法?