diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/processing/Find.java b/hibernate-core/src/main/java/org/hibernate/annotations/processing/Find.java index 91642393b2..9908855b02 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/processing/Find.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/processing/Find.java @@ -47,6 +47,14 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * encode no semantics. * *
+ * It's even possible to query by a field of an embedded object: + *
+ * @Find + * List<Book> publishedBooks(String publisher$name); + *+ * Here, {@code publisher$name} refers to the field {@code name} of + * the {@code Book}'s {@code Publisher}. + *
* The Metamodel Generator automatically creates an "implementation" * of every finder method in the static metamodel class {@code Books_}. * The generated method may be called according to the following @@ -133,6 +141,12 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * (varargs) where {@code E} is the entity type returned by the * query. * + *
+ * For example: + *
+ * @Find + * List<Book> getBooksWithTitle(String title, List<Order<Book>> order); + ** * @see HQL * @see SQL diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/processing/HQL.java b/hibernate-core/src/main/java/org/hibernate/annotations/processing/HQL.java index dd7a19f1a8..5398b62ed3 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/processing/HQL.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/processing/HQL.java @@ -23,13 +23,13 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * For example: *
* public interface Books { - * @HQL("from Book where isbn = :isbn") + * @HQL("where isbn = :isbn") * Book findBookByIsbn(String isbn); * - * @HQL("from Book where title like ?1 order by title offset ?3 fetch first ?2 rows only") + * @HQL("where title like ?1 order by title offset ?3 fetch first ?2 rows only") * List<Book> findBooksByTitleWithPagination(String title, int max, int start); * - * @HQL("from Book where title like ?1") + * @HQL("where title like ?1") * TypedQuery<Book> createBooksByTitleQuery(String title); * } *@@ -111,6 +111,12 @@ import static java.lang.annotation.RetentionPolicy.CLASS; * query. * *
+ * For example: + *
+ * @HQL("where title like :title) + * List<Book> findBooksByTitleWithPagination(String title, Page page, Order<Book> order); + *+ *
* Queries specified using this annotation are always validated by * the Metamodel Generator, and so it isn't necessary to specify the * {@link CheckHQL} annotation.