File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
hibernate-core/src/main/java/org/hibernate/annotations/processing Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 3939 * Notice that:
4040 * <ul>
4141 * <li>the types and names of the method parameters exactly match the
42- * types and names of the corresponding fields of the entity.
42+ * types and names of the corresponding fields of the entity, and
4343 * <li>there's no special naming convention for the {@code @Find}
4444 * methods—they may be named arbitrarily, and their names
4545 * encode no semantics.
4646 * </ul>
4747 * <p>
48+ * Alternatively, a method parameter may have the type
49+ * {@link org.hibernate.query.range.Range Range<T>} where
50+ * {@code T} is the type of the corresponding field in the entity.
51+ * <pre>
52+ * @Find
53+ * Book getBookForIsbn(Range<String> isbn);
54+ *
55+ * @Find
56+ * List<Book> getBooksWithTitle(Range<String> title);
57+ * </pre>
58+ * This allows the matching field to be restricted based on a variety
59+ * of criteria expressed via the static factory methods of {@code Range}.
60+ * <p>
4861 * It's even possible to query by a field of an embedded object:
4962 * <pre>
5063 * @Find
154167 * <li>return type {@link org.hibernate.query.KeyedResultList}, and
155168 * <li>a parameter of type {@link org.hibernate.query.KeyedPage}.
156169 * </ul>
170+ * <p>
171+ * Finally, a method might have a parameter of type
172+ * {@link org.hibernate.query.Restriction Restriction<? super E>},
173+ * allowing the caller to apply an arbitrary filtering criterion to
174+ * the query results.
175+ * <p>
176+ * For example:
177+ * <pre>
178+ * @Find
179+ * List<Book> getBooks(Restriction<Book> filter, List<Order<Book>> order);
180+ * </pre>
157181 *
158182 * @see HQL
159183 * @see SQL
Original file line number Diff line number Diff line change 134134 * <li>a parameter of type {@link org.hibernate.query.KeyedPage}.
135135 * </ul>
136136 * <p>
137+ * Finally, a method might have a parameter of type
138+ * {@link org.hibernate.query.Restriction Restriction<? super E>},
139+ * allowing the caller to apply an arbitrary filtering criterion to
140+ * the query results.
141+ * <p>
142+ * For example:
143+ * <pre>
144+ * @HQL("from Book")
145+ * List<Book> findBooks(Restriction<Book> filter, List<Order<Book>> order);
146+ * </pre>
147+ * <p>
137148 * Queries specified using this annotation are always validated by
138149 * the Metamodel Generator, and so it isn't necessary to specify the
139150 * {@link CheckHQL} annotation.
You can’t perform that action at this time.
0 commit comments