diff --git a/jOOQ/src/main/java/org/jooq/ResultQuery.java b/jOOQ/src/main/java/org/jooq/ResultQuery.java index 11edb9422c..efd9569662 100644 --- a/jOOQ/src/main/java/org/jooq/ResultQuery.java +++ b/jOOQ/src/main/java/org/jooq/ResultQuery.java @@ -197,6 +197,24 @@ extends * Stream this query. *
* This is just a synonym for {@link #stream()}. + *
+ * Clients should ensure the {@link Stream} is properly closed, e.g. in a + * try-with-resources statement: + *
+ *
+ *
+ * try (Stream<R> stream = query.stream()) {
+ * // Do things with stream
+ * }
+ *
+ * If users prefer more fluent style streaming of queries, {@link ResultSet} + * can be registered and closed via {@link ExecuteListener}, or via "smart" + * third-party {@link DataSource}s. + *
+ * Depending on your JDBC driver's default behaviour, this may load the + * whole database result into the driver's memory. In order to indicate to + * the driver that you may not want to fetch all records at once, use + * {@link #fetchSize(int)} prior to calling this method. * * @return The result. * @throws DataAccessException if something went wrong executing the query @@ -209,7 +227,25 @@ extends *
* This is the same as calling
* fetchStream().map(r -> r.into(type)). See
- * {@link Record#into(Class)} for more details
+ * {@link Record#into(Class)} for more details.
+ *
+ * Clients should ensure the {@link Stream} is properly closed, e.g. in a + * try-with-resources statement: + *
+ *
+ *
+ * try (Stream<R> stream = query.stream()) {
+ * // Do things with stream
+ * }
+ *
+ * If users prefer more fluent style streaming of queries, {@link ResultSet} + * can be registered and closed via {@link ExecuteListener}, or via "smart" + * third-party {@link DataSource}s. + *
+ * Depending on your JDBC driver's default behaviour, this may load the
+ * whole database result into the driver's memory. In order to indicate to
+ * the driver that you may not want to fetch all records at once, use
+ * {@link #fetchSize(int)} prior to calling this method.
*
* @param
* This is the same as calling
*
* The result and its contained records are attached to the original
* {@link Configuration} by default. Use {@link Settings#isAttachRecords()}
* to override this behaviour.
+ *
+ * Clients should ensure the {@link Stream} is properly closed, e.g. in a
+ * try-with-resources statement:
+ *
+ *
+ * If users prefer more fluent style streaming of queries, {@link ResultSet}
+ * can be registered and closed via {@link ExecuteListener}, or via "smart"
+ * third-party {@link DataSource}s.
+ *
+ * Depending on your JDBC driver's default behaviour, this may load the
+ * whole database result into the driver's memory. In order to indicate to
+ * the driver that you may not want to fetch all records at once, use
+ * {@link #fetchSize(int)} prior to calling this method.
*
* @param fetchStream().map(r -> r.into(table)). See
- * {@link Record#into(Table)} for more details
+ * {@link Record#into(Table)} for more details.
*
+ *
+ * try (Stream<R> stream = query.stream()) {
+ * // Do things with stream
+ * }
+ *