|
18 | 18 | /**
|
19 | 19 | * A rule for sorting a query result set.
|
20 | 20 | * <p>
|
21 |
| - * This is a convenience class which allows query result ordering |
22 |
| - * rules to be passed around the system before being applied to |
23 |
| - * a {@link Query} by calling {@link SelectionQuery#setOrder(Order)}. |
| 21 | + * This is a convenience class which allows query result ordering rules to be |
| 22 | + * passed around the system before being applied to a {@link Query} by calling |
| 23 | + * {@link org.hibernate.query.programmatic.SelectionSpecification#sort(Order)}. |
24 | 24 | * <pre>
|
25 |
| - * session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class) |
| 25 | + * SelectionSpecification.create(Book.class, |
| 26 | + * "from Book b join b.authors a where a.name = :name") |
| 27 | + * .sort(asc(Book_.publicationDate)) |
| 28 | + * .createQuery(session) |
26 | 29 | * .setParameter("name", authorName)
|
27 |
| - * .setOrder(asc(Book_.publicationDate)) |
28 | 30 | * .getResultList();
|
29 | 31 | * </pre>
|
30 | 32 | * <p>
|
31 | 33 | * {@code Order}s may be stacked using {@link List#of} and
|
32 |
| - * {@link SelectionQuery#setOrder(List)}. |
| 34 | + * {@link org.hibernate.query.programmatic.SelectionSpecification#resort(List)}. |
33 | 35 | * <pre>
|
34 |
| - * session.createSelectionQuery("from Book b join b.authors a where a.name = :name", Book.class) |
| 36 | + * SelectionSpecification.create(Book.class, |
| 37 | + * "from Book b join b.authors a where a.name = :name") |
| 38 | + * .sort(List.of(asc(Book_.publicationDate), desc(Book_.ssn))) |
35 | 39 | * .setParameter("name", authorName)
|
36 |
| - * .setOrder(List.of(asc(Book_.publicationDate), desc(Book_.ssn))) |
37 | 40 | * .getResultList();
|
38 | 41 | * </pre>
|
39 | 42 | * <p>
|
|
49 | 52 | * used by Hibernate Data Repositories to implement Jakarta Data
|
50 | 53 | * query methods.
|
51 | 54 | *
|
52 |
| - * @see SelectionQuery#setOrder(Order) |
53 |
| - * @see SelectionQuery#setOrder(java.util.List) |
| 55 | + * @see org.hibernate.query.programmatic.SelectionSpecification#sort(Order) |
| 56 | + * @see org.hibernate.query.programmatic.SelectionSpecification#resort(List) |
54 | 57 | * @see org.hibernate.query.restriction.Restriction
|
55 | 58 | *
|
56 | 59 | * @author Gavin King
|
|
0 commit comments