我正在使用休眠命名查询。GetEmployerWithActiveEmployeeList
public class Employer {
.
.
@OneToMany(mappedBy = "employer", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
private Set<Employee> employee;
.
.
}
public class Employee {
...
@ManyToOne(cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "employer_id")
private Employer employer;
...
}
现在我想编写命名查询来 fetchEmployerWithActiveEmployee
我的命名查询是这样的
"from Employer employer left join employer.employees emp where employer.id=:employerId and emp.status = 1"
当我检查雇主对象时,它会向我显示所有员工。
这在休眠中可能吗?