diff --git a/jOOQ/src/main/java/org/jooq/ResultQuery.java b/jOOQ/src/main/java/org/jooq/ResultQuery.java index 29f4ded785..382724ddc4 100644 --- a/jOOQ/src/main/java/org/jooq/ResultQuery.java +++ b/jOOQ/src/main/java/org/jooq/ResultQuery.java @@ -69,15 +69,25 @@ import org.jooq.impl.DefaultRecordMapper; * A query that can return results. Mostly, this is a {@link Select} query used * for a SELECT statement. *

- *

Lifecycle guarantees

Most methods in this type are based on - * {@link #fetch()}, which completes the whole {@link ConnectionProvider} and - * {@link ExecuteListener} lifecycles, eagerly fetching all results into memory. - * Underlying JDBC {@link ResultSet}s are always closed. Underlying JDBC - * {@link PreparedStatement}s are closed, unless {@link #keepStatement(boolean)} - * is set. + *

Lifecycle guarantees

+ *

+ * Most methods in this type are based on {@link #fetch()}, which completes the + * whole {@link ConnectionProvider} and {@link ExecuteListener} lifecycles, + * eagerly fetching all results into memory. Underlying JDBC {@link ResultSet}s + * are always closed. Underlying JDBC {@link PreparedStatement}s are closed, + * unless {@link #keepStatement(boolean)} is set. *

* In order to keep open {@link ResultSet}s and fetch records lazily, use * {@link #fetchLazy()} instead and then operate on {@link Cursor}. + *

+ *

Performance

+ *

+ * Methods throwing {@link TooManyRowsException} need to retrieve at most two + * records from the underlying JDBC {@link ResultSet}, which, depending on the + * {@link java.sql.Statement#getFetchSize()} / + * {@link ResultQuery#fetchSize(int)}, might incur additional database + * roundtrips. If this causes problems, {@link ResultQuery#fetchAny()} may be + * preferred. * * @author Lukas Eder */ diff --git a/jOOQ/src/main/java/org/jooq/exception/TooManyRowsException.java b/jOOQ/src/main/java/org/jooq/exception/TooManyRowsException.java index bb1ee71799..c41d50bee5 100644 --- a/jOOQ/src/main/java/org/jooq/exception/TooManyRowsException.java +++ b/jOOQ/src/main/java/org/jooq/exception/TooManyRowsException.java @@ -37,6 +37,8 @@ */ package org.jooq.exception; +import java.sql.ResultSet; + import org.jooq.InsertResultStep; import org.jooq.ResultQuery; @@ -51,6 +53,15 @@ import org.jooq.ResultQuery; * {@link InsertResultStep#fetchOne()} on an INSERT statement, the * database change will still be executed: the rows will still be locked or * inserted. + *

+ * Performance + *

+ * Methods throwing {@link TooManyRowsException} need to retrieve at most two + * records from the underlying JDBC {@link ResultSet}, which, depending on the + * {@link java.sql.Statement#getFetchSize()} / + * {@link ResultQuery#fetchSize(int)}, might incur additional database + * roundtrips. If this causes problems, {@link ResultQuery#fetchAny()} may be + * preferred. * * @author Lukas Eder */