简体   繁体   中英

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:

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?

For an alternative see Hibernate Union alternatives

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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