Skip to content

Commit 8e4755f

Browse files
committed
further improvements to jdoc of @find and @hql
1 parent d96b5df commit 8e4755f

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

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

+14
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@
4747
* encode no semantics.
4848
* </ul>
4949
* <p>
50+
* It's even possible to query by a field of an embedded object:
51+
* <pre>
52+
* &#064;Find
53+
* List&lt;Book&gt; publishedBooks(String publisher$name);
54+
* </pre>
55+
* Here, {@code publisher$name} refers to the field {@code name} of
56+
* the {@code Book}'s {@code Publisher}.
57+
* <p>
5058
* The Metamodel Generator automatically creates an "implementation"
5159
* of every finder method in the static metamodel class {@code Books_}.
5260
* The generated method may be called according to the following
@@ -133,6 +141,12 @@
133141
* (varargs) where {@code E} is the entity type returned by the
134142
* query.
135143
* </ul>
144+
* <p>
145+
* For example:
146+
* <pre>
147+
* &#064;Find
148+
* List&lt;Book&gt; getBooksWithTitle(String title, List&lt;Order&lt;Book&gt;&gt; order);
149+
* </pre>
136150
*
137151
* @see HQL
138152
* @see SQL

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
* For example:
2424
* <pre>
2525
* public interface Books {
26-
* &#64;HQL("from Book where isbn = :isbn")
26+
* &#64;HQL("where isbn = :isbn")
2727
* Book findBookByIsbn(String isbn);
2828
*
29-
* &#64;HQL("from Book where title like ?1 order by title offset ?3 fetch first ?2 rows only")
29+
* &#64;HQL("where title like ?1 order by title offset ?3 fetch first ?2 rows only")
3030
* List&lt;Book&gt; findBooksByTitleWithPagination(String title, int max, int start);
3131
*
32-
* &#64;HQL("from Book where title like ?1")
32+
* &#64;HQL("where title like ?1")
3333
* TypedQuery&lt;Book&gt; createBooksByTitleQuery(String title);
3434
* }
3535
* </pre>
@@ -111,6 +111,12 @@
111111
* query.
112112
* </ul>
113113
* <p>
114+
* For example:
115+
* <pre>
116+
* &#64;HQL("where title like :title)
117+
* List&lt;Book&gt; findBooksByTitleWithPagination(String title, Page page, Order&lt;Book&gt; order);
118+
* </pre>
119+
* <p>
114120
* Queries specified using this annotation are always validated by
115121
* the Metamodel Generator, and so it isn't necessary to specify the
116122
* {@link CheckHQL} annotation.

0 commit comments

Comments
 (0)