简体   繁体   English

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

[英]How to write HQL query for the following SQL Query?

This is a query to fetch data from two tables 这是从两个表中获取数据的查询

blogs 网志

and

askquestions 问问题

HQL query For following SQL query: 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

Thanks in advance for any answers or suggestions!!! 在此先感谢您的任何答案或建议!

Unions are not supported by hibernate, see How to do a Union SQL statement in HQL? 休眠不支持并集,请参见如何在HQL中执行并集SQL语句?

For an alternative see Hibernate Union alternatives 有关替代方法,请参见Hibernate Union替代方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM