File tree Expand file tree Collapse file tree 3 files changed +39
-4
lines changed
hibernate-core/src/main/java/org/hibernate/query Expand file tree Collapse file tree 3 files changed +39
-4
lines changed Original file line number Diff line number Diff line change 4747 * }
4848 * </pre>
4949 *
50+ * @apiNote This class is similar to {@code jakarta.data.page.CursoredPage},
51+ * and is used by Hibernate Data Repositories to implement
52+ * Jakarta Data query methods.
53+ *
5054 * @since 6.5
5155 *
5256 * @see KeyedPage
Original file line number Diff line number Diff line change 2020 * <p>
2121 * This is a convenience class which allows query result ordering
2222 * rules to be passed around the system before being applied to
23- * a {@link Query} by calling {@link SelectionQuery#setOrder}.
23+ * a {@link Query} by calling {@link SelectionQuery#setOrder(Order)}.
24+ * <pre>
25+ * session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class)
26+ * .setParameter("name", authorName)
27+ * .setOrder(asc(Book_.publicationDate))
28+ * .getResultList();
29+ * </pre>
30+ * <p>
31+ * {@code Order}s may be stacked using {@link List#of} and
32+ * {@link SelectionQuery#setOrder(List)}.
33+ * <pre>
34+ * session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class)
35+ * .setParameter("name", authorName)
36+ * .setOrder(List.of(asc(Book_.publicationDate), desc(Book_.ssn)))
37+ * .getResultList();
38+ * </pre>
2439 * <p>
2540 * A parameter of a {@linkplain org.hibernate.annotations.processing.Find
2641 * finder method} or {@linkplain org.hibernate.annotations.processing.HQL
3045 *
3146 * @param <X> The result type of the query to be sorted
3247 *
48+ * @apiNote This class is similar to {@code jakarta.data.Sort}, and is
49+ * used by Hibernate Data Repositories to implement Jakarta Data
50+ * query methods.
51+ *
3352 * @see SelectionQuery#setOrder(Order)
3453 * @see SelectionQuery#setOrder(java.util.List)
3554 *
Original file line number Diff line number Diff line change 1010
1111/**
1212 * Identifies a page of query results by {@linkplain #size page size}
13- * and {@linkplain #number page number}.
13+ * and {@linkplain #number page number}. This is an alternative to the
14+ * use of the JPA-defined operations {@link SelectionQuery#setFirstResult}
15+ * and {@link SelectionQuery#setMaxResults}.
16+ * <pre>
17+ * session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class)
18+ * .setParameter("name", authorName)
19+ * .setPage(Page.first(100))
20+ * .getResultList();
21+ * </pre>
1422 * <p>
1523 * This is a convenience class which allows a reference to a page of
16- * results to be passed around the system before being applied to
17- * a {@link Query} by calling {@link Query#setPage(Page)}.
24+ * results to be passed around the system before being applied to a
25+ * {@link Query} by calling {@link Query#setPage(Page)}.
1826 * <p>
1927 * A parameter of a {@linkplain org.hibernate.annotations.processing.Find
2028 * finder method} or {@linkplain org.hibernate.annotations.processing.HQL
2331 * For key-based pagination, call {@link #keyedBy(Order)} to obtain a
2432 * {@link KeyedPage}.
2533 *
34+ * @apiNote This class is similar to {@code jakarta.data.page.PageRequest},
35+ * and is used by Hibernate Data Repositories to implement
36+ * Jakarta Data query methods.
37+ *
2638 * @see SelectionQuery#setPage(Page)
2739 *
2840 * @since 6.3
You can’t perform that action at this time.
0 commit comments