如何为以下SQL查询编写HQL查询?

时间:2014-02-18 12:48:03

标签: mysql sql hibernate hql

这是从两个表中获取数据的查询

  

博客

  

askquestions

HQL查询用于以下SQL查询:

select title , date from (select blog_title as title ,created_date as date from  blog  union select ask_question as title , created_on as date from askquestions ) as aa order by date desc

提前感谢您的任何答案或建议!

1 个答案:

答案 0 :(得分:0)

hibernate不支持联合,请参阅How to do a Union SQL statement in HQL?

有关替代方案,请参阅Hibernate Union alternatives