diff --git a/hibernate-core/src/main/java/org/hibernate/query/MutationQuery.java b/hibernate-core/src/main/java/org/hibernate/query/MutationQuery.java index e45eeb5d1f42..046a9c097ebc 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/MutationQuery.java +++ b/hibernate-core/src/main/java/org/hibernate/query/MutationQuery.java @@ -46,6 +46,11 @@ * {@link #setParameter(int, Object)} allow arguments to be bound to named * and ordinal parameters defined by the query. * + *
+ * session.createMutationQuery("delete Draft where lastUpdated < local date - ?1 year")
+ * .setParameter(1, years)
+ * .executeUpdate();
+ *
*
* @author Steve Ebersole
*/
diff --git a/hibernate-core/src/main/java/org/hibernate/query/SelectionQuery.java b/hibernate-core/src/main/java/org/hibernate/query/SelectionQuery.java
index 7a403deee2bd..f63015564692 100644
--- a/hibernate-core/src/main/java/org/hibernate/query/SelectionQuery.java
+++ b/hibernate-core/src/main/java/org/hibernate/query/SelectionQuery.java
@@ -66,6 +66,24 @@
* {@link #setParameter(int, Object)} allow arguments to be bound to named
* and ordinal parameters defined by the query.
*
+ * A query which returns multiple results should be executed via
+ * {@link #getResultList()}:
+ *
+ * List<Book> books =
+ * session.createSelectionQuery("from Book left join fetch authors where title like :title")
+ * .setParameter("title", title)
+ * .setMaxResults(50)
+ * .getResultList();
+ *
+ * A query which is expected to return exactly one on result should be executed
+ * via {@link #getSingleResult()}, or, if it might not return a result,
+ * {@link #getSingleResultOrNull()}:
+ *
+ * Book book =
+ * session.createSelectionQuery("from Book where isbn = ?1")
+ * .setParameter(1, isbn)
+ * .getSingleResultOrNull();
+ *
* * A query may have explicit fetch joins, specified using the syntax * {@code join fetch} in HQL, or via {@link jakarta.persistence.criteria.From#fetch}