Forums Register Login
HQL help needed
Hi All,

I have two objects Person, Manager and the objects are mapped to database tables Person and Manager. I want to get all the persons having no manager at all or having manager whose name is "xyz".

SQL query to get the desired result is

I want to get the same result using HQL query and tried the following HQL query. But it is not giving expected results.

Any help on HQL query is appreciated.


Use joins.
Hibernate support for unions is selective.
If you're still uncomfortable and have a complex query, user result set transformer AliasToEntity Mapping and map your query results into your pojo.
But, in this case, I would suggest you to use a simple join.

This thread has been viewed 991 times.

All times above are in ranch (not your local) time.
The current ranch time is
Dec 14, 2018 06:10:48.