Skip to content

Commit f1bcb1f

Browse files
committed
HHH-18979 add Order/Restriction to jdoc for @find and @hql
1 parent 3bdbf46 commit f1bcb1f

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

hibernate-core/src/main/java/org/hibernate/annotations/processing/Find.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,25 @@
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&mdash;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&lt;T&gt;} where
50+
* {@code T} is the type of the corresponding field in the entity.
51+
* <pre>
52+
* &#064;Find
53+
* Book getBookForIsbn(Range&lt;String&gt; isbn);
54+
*
55+
* &#064;Find
56+
* List&lt;Book&gt; getBooksWithTitle(Range&lt;String&gt; 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
* &#064;Find
@@ -154,6 +167,17 @@
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+
* &#064;Find
179+
* List&lt;Book&gt; getBooks(Restriction&lt;Book&gt; filter, List&lt;Order&lt;Book&gt;&gt; order);
180+
* </pre>
157181
*
158182
* @see HQL
159183
* @see SQL

hibernate-core/src/main/java/org/hibernate/annotations/processing/HQL.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,17 @@
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+
* &#064;HQL("from Book")
145+
* List&lt;Book&gt; findBooks(Restriction&lt;Book&gt; filter, List&lt;Order&lt;Book&gt;&gt; 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.

0 commit comments

Comments
 (0)