diff --git a/hibernate-core/src/main/java/org/hibernate/query/KeyedResultList.java b/hibernate-core/src/main/java/org/hibernate/query/KeyedResultList.java index fac3448058b5..3f6fc41f5b39 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/KeyedResultList.java +++ b/hibernate-core/src/main/java/org/hibernate/query/KeyedResultList.java @@ -47,6 +47,10 @@ * } * * + * @apiNote This class is similar to {@code jakarta.data.page.CursoredPage}, + * and is used by Hibernate Data Repositories to implement + * Jakarta Data query methods. + * * @since 6.5 * * @see KeyedPage diff --git a/hibernate-core/src/main/java/org/hibernate/query/Order.java b/hibernate-core/src/main/java/org/hibernate/query/Order.java index be7c6a1b5679..a15d241d8568 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/Order.java +++ b/hibernate-core/src/main/java/org/hibernate/query/Order.java @@ -20,7 +20,22 @@ *
* This is a convenience class which allows query result ordering * rules to be passed around the system before being applied to - * a {@link Query} by calling {@link SelectionQuery#setOrder}. + * a {@link Query} by calling {@link SelectionQuery#setOrder(Order)}. + *
+ * session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class)
+ * .setParameter("name", authorName)
+ * .setOrder(asc(Book_.publicationDate))
+ * .getResultList();
+ *
+ * + * {@code Order}s may be stacked using {@link List#of} and + * {@link SelectionQuery#setOrder(List)}. + *
+ * session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class)
+ * .setParameter("name", authorName)
+ * .setOrder(List.of(asc(Book_.publicationDate), desc(Book_.ssn)))
+ * .getResultList();
+ *
*
* A parameter of a {@linkplain org.hibernate.annotations.processing.Find
* finder method} or {@linkplain org.hibernate.annotations.processing.HQL
@@ -30,6 +45,10 @@
*
* @param
* This is a convenience class which allows a reference to a page of
- * results to be passed around the system before being applied to
- * a {@link Query} by calling {@link Query#setPage(Page)}.
+ * results to be passed around the system before being applied to a
+ * {@link Query} by calling {@link Query#setPage(Page)}.
*
* A parameter of a {@linkplain org.hibernate.annotations.processing.Find
* finder method} or {@linkplain org.hibernate.annotations.processing.HQL
@@ -23,6 +31,10 @@
* For key-based pagination, call {@link #keyedBy(Order)} to obtain a
* {@link KeyedPage}.
*
+ * @apiNote This class is similar to {@code jakarta.data.page.PageRequest},
+ * and is used by Hibernate Data Repositories to implement
+ * Jakarta Data query methods.
+ *
* @see SelectionQuery#setPage(Page)
*
* @since 6.3
+ * session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class)
+ * .setParameter("name", authorName)
+ * .setPage(Page.first(100))
+ * .getResultList();
+ *
*