I want to convert the following subquery to use hibernate subquery:
getCurrentSession().createQuery("from Employee where id in (select adminId from Department where adminId is not null)")
.list();
Employee:
@ManyToOne @JoinColumn(name = "fk_department_id", nullable = true) private Department department;
Department:
@OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "fk_department_id") private Set<Employee> employees = new HashSet<Employee>(0);
Can anyone please provide me with an example of this convert, because i read some examples and i still cannot figure out how to do that.
Preferences -> Java -> CodeStyle -> Formatter -> Edit -> Indentation -> Tab policy: Spaces only
. I've just done it manually - it was few lines, so it wasn't a big pain :-) – Hammy