Using Hibernate I wonder how can I solve this issue: I have a table of USER, some are employees some are managers. Managers have a NULL value in the MANAGER_ID (I over simplify this issue on purpose).
Q: what should be the relationship in the POJO for USER so when I select a USER with NULL value - I will be able to get a list of all employees
AND when selecting an employee - I can get the Manager.
I think your entity should have a field name manager of type User which should be nullable and it should have one to one association with the User entity and ofcourse your manager field will NOT be unique.(Such type of Joins are called Self Joins in SQL)