File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
hibernate-core/src/main/java/org/hibernate/query Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1717/**
1818 * A rule for restricting query results.
1919 * <p>
20- * This allows restrictions to be added to a {@link Query } by calling
20+ * This allows restrictions to be added to a {@link SelectionQuery } by calling
2121 * {@link SelectionQuery#addRestriction(Restriction)}.
2222 * <pre>
2323 * session.createSelectionQuery("from Book", Book.class)
2424 * .addRestriction(Restriction.like(Book_.title, "%Hibernate%", false))
2525 * .addRestriction(Restriction.greaterThan(Book_.pages, 100))
2626 * .setOrder(Order.desc(Book_.title))
27- * .getResultList() );
27+ * .getResultList() );
2828 * </pre>
2929 * <p>
3030 * Each restriction pairs an {@linkplain SingularAttribute attribute} of the
Original file line number Diff line number Diff line change 9999 * every {@link jakarta.persistence.FetchType#EAGER eager} {@code @ManyToOne} or
100100 * {@code @OneToOne} association belonging to an entity returned by the query.
101101 * <p>
102+ * The method {@link #addRestriction(Restriction)} allows application of additional
103+ * {@linkplain Restriction filtering} to the query results. The static factory
104+ * methods of {@code Restriction} are used to express filtering criteria of various
105+ * kinds.
106+ * <p>
102107 * Finally, two alternative approaches to pagination are available:
103108 * <ol>
104109 * <li>
105110 * The operations and {@link #setOrder(List)} and {@link #setPage(Page)}, together
106111 * with {@link Order} and {@link Page}, provide a streamlined API for offset-based
107112 * pagination, at a slightly higher semantic level than the ancient but dependable
108113 * {@link #setFirstResult(int)} and {@link #setMaxResults(int)}.
114+ * <pre>
115+ * session.createSelectionQuery("from Book", Book.class)
116+ * .addRestriction(Restriction.contains(Book_.title, "hibernate", false))
117+ * .setOrder(Order.desc(Book_.title))
118+ * .setPage(Page.first(50))
119+ * .getResultList() );
120+ * </pre>
109121 * <li>
110122 * On the other hand, {@link KeyedPage} and {@link KeyedResultList}, along with
111123 * {@link #getKeyedResultList(KeyedPage)}, provide for <em>key-based pagination</em>,
You can’t perform that action at this time.
0 commit comments