次のサブクエリを hibernate サブクエリを使用するように変換したい:
getCurrentSession().createQuery("from Employee where id in (select adminId from Department where adminId is not null)")
.list();
従業員:
@ManyToOne @JoinColumn(name = "fk_department_id", nullable = true) private Department department;
デパートメント:
@OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "fk_department_id") private Set<Employee> employees = new HashSet<Employee>(0);
いくつかの例を読んでも、まだその方法がわからないので、この変換の例を教えてください。