I've got two tables A and B. I execute LEFT OUTER JOIN on it and works fine. I tried to limit rows number by table A, so for me when I ask for 5 rows I want 5 rows from table A joined with no matter how many rows from table B.
Just like:
select * from (select * from A where rownum < ? ) a left outer join B b on a.id=b.id;
I've tried to use hibernate criteria API, and methods setMaxResult on joined criteria, but what hibernate does is:
select * from( select * from A a left outer join B b on a.id=b.id) where rownum < ?;
JPA/hibernate doesn't support subqueries in from clauses, any idea how to reach this result?
Michal