diff --git a/src/main/java/io/ebean/Query.java b/src/main/java/io/ebean/Query.java index eb4e0daa4..601e3a889 100644 --- a/src/main/java/io/ebean/Query.java +++ b/src/main/java/io/ebean/Query.java @@ -668,15 +668,13 @@ public interface Query { * .where().eq("status", Status.NEW) * .order().asc("id"); * - * QueryIterator it = query.findIterate(); - * try { + * // use try with resources to ensure QueryIterator is closed + * + * try (QueryIterator it = query.findIterate()) { * while (it.hasNext()) { * Customer customer = it.next(); * // do something with customer ... * } - * } finally { - * // close the underlying resources - * it.close(); * } * * }