File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HQL help needed

 
Venkata Kumar
Ranch Hand
Posts: 110
Firefox Browser Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,
Venkat



 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic