Let's say I have two tables, Books and Reviews. Reviews has a column, stars, that can have a value between 1 and 5. A Book can have many Reviews.
How would I select all books such that only the top and bottom 3 reviews for each book are returned (instead of all reviews) using the Criteria API?
If the Criteria API is not capable, I am up for other suggestions like HQL, SQL, etc.