nverma (1) [Avatar] Offline
How does hibernate handle UNION in a SQL. I have to run a query that selects a different set of columns from the same table based on a parameter. I have to use the union clause, but I can't find any lead on how would Hibernate's Query object address this issue.

For a table say, Employee with columns, Id, FName, LName, I want to do the following

select ID, FName as Name where LName is null
select ID, LName as Name where FName is null
order by 2

How can I do it using Hibernate's Query object

Any help would be appreciated