2

I have to fetch values from two unrelated tables using HQL .

HQL1= from AbstractTea x where   x.site in (:currentSearchSite) and 
      x.status = :status and 1=1

HQL2= from AbstractCoffee x where   x.site in (:currentSearchSite) and 
      x.status = :status and 1=1

I have to combine the resultset of both queries, to make it work in pagination

I used UNION ALL , but that did'nt work out

I use Scrollable results for pagination , So I tried to run the query seprately.

ScrollableResults results = query.scroll();
ScrollableResults results2 = query2.scroll();

I dont know how to get the pagination work , by combining the two results Using ScrollableResults

Cork Kochi
  • 1,783
  • 6
  • 29
  • 45
  • `UNION` only work in the EclipseLink implementation of JPA. I really cannot figure out how do this query in JPA/Hibernate... maybe you can write this query using FULL JOIN, but I can't say how too... Try to find other ways to do a `UNION` using `JOIN`, some idea can show up – Dherik Nov 25 '15 at 00:50

0 Answers0