我有下一个班级关系:
public class Company {
. . .
@OneToMany(mappedBy = "company", fetch = FetchType.EAGER, cascade=CascadeType.PERSIST)
private Set<CompanySecUser> companySecUsers;
. . .
}
public class CompanySecUser{
. . .
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="USER_ID")
private User secUser;
@Column(name = "IS_READ")
private BigDecimal isRead;
. . .
}
现在如何在公司实体的 JPA 中编写查询以仅获取具有指定 secUser.id 和 isRead = 1 的公司?