add some javadoc to KeyedResultList, Order, Page

This commit is contained in:
Gavin King 2024-11-13 09:52:51 +01:00
parent 65b9b43756
commit eb6cb31fdf
3 changed files with 39 additions and 4 deletions

View File

@ -47,6 +47,10 @@ import java.util.List;
* } * }
* </pre> * </pre>
* *
* @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 * @since 6.5
* *
* @see KeyedPage * @see KeyedPage

View File

@ -20,7 +20,22 @@ import static org.hibernate.query.SortDirection.DESCENDING;
* <p> * <p>
* This is a convenience class which allows query result ordering * This is a convenience class which allows query result ordering
* rules to be passed around the system before being applied to * 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)}.
* <pre>
* session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class)
* .setParameter("name", authorName)
* .setOrder(asc(Book_.publicationDate))
* .getResultList();
* </pre>
* <p>
* {@code Order}s may be stacked using {@link List#of} and
* {@link SelectionQuery#setOrder(List)}.
* <pre>
* 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();
* </pre>
* <p> * <p>
* A parameter of a {@linkplain org.hibernate.annotations.processing.Find * A parameter of a {@linkplain org.hibernate.annotations.processing.Find
* finder method} or {@linkplain org.hibernate.annotations.processing.HQL * finder method} or {@linkplain org.hibernate.annotations.processing.HQL
@ -30,6 +45,10 @@ import static org.hibernate.query.SortDirection.DESCENDING;
* *
* @param <X> The result type of the query to be sorted * @param <X> The result type of the query to be sorted
* *
* @apiNote This class is similar to {@code jakarta.data.Sort}, and is
* used by Hibernate Data Repositories to implement Jakarta Data
* query methods.
*
* @see SelectionQuery#setOrder(Order) * @see SelectionQuery#setOrder(Order)
* @see SelectionQuery#setOrder(java.util.List) * @see SelectionQuery#setOrder(java.util.List)
* *

View File

@ -10,11 +10,19 @@ import java.util.List;
/** /**
* Identifies a page of query results by {@linkplain #size page size} * Identifies a page of query results by {@linkplain #size page size}
* and {@linkplain #number page number}. * and {@linkplain #number page number}. This is an alternative to the
* use of the JPA-defined operations {@link SelectionQuery#setFirstResult}
* and {@link SelectionQuery#setMaxResults}.
* <pre>
* session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class)
* .setParameter("name", authorName)
* .setPage(Page.first(100))
* .getResultList();
* </pre>
* <p> * <p>
* This is a convenience class which allows a reference to a page of * This is a convenience class which allows a reference to a page of
* results to be passed around the system before being applied to * results to be passed around the system before being applied to a
* a {@link Query} by calling {@link Query#setPage(Page)}. * {@link Query} by calling {@link Query#setPage(Page)}.
* <p> * <p>
* A parameter of a {@linkplain org.hibernate.annotations.processing.Find * A parameter of a {@linkplain org.hibernate.annotations.processing.Find
* finder method} or {@linkplain org.hibernate.annotations.processing.HQL * finder method} or {@linkplain org.hibernate.annotations.processing.HQL
@ -23,6 +31,10 @@ import java.util.List;
* For key-based pagination, call {@link #keyedBy(Order)} to obtain a * For key-based pagination, call {@link #keyedBy(Order)} to obtain a
* {@link KeyedPage}. * {@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) * @see SelectionQuery#setPage(Page)
* *
* @since 6.3 * @since 6.3