[jOOQ/jOOQ#13183] Add Javadoc warnings to UpdatableRecord::fetchChildren, and TableRecord::fetchParent about the N+1 problem

This commit is contained in:
Lukas Eder 2022-03-02 16:14:47 +01:00
parent 54f2538ae9
commit cec7dbb4b5
2 changed files with 25 additions and 1 deletions

View File

@ -109,7 +109,13 @@ public interface TableRecord<R extends TableRecord<R>> extends QualifiedRecord<R
* <p>
* This returns a parent record referenced by this record through a given
* foreign key, as if fetching from {@link #parent(ForeignKey)}. If no
* parent record was found, this returns <code>null</code>
* parent record was found, this returns <code>null</code>.
* <p>
* <strong>A separate roundtrip is created by this operation.</strong> It is
* often much better to include parent records using ordinary
* <code>JOIN</code> mechanisms in a single query, or using nested records,
* see <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/nested-records/">https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/nested-records/</a>.
*
* @throws DataAccessException if something went wrong executing the query
* @see ForeignKey#fetchParent(Record)

View File

@ -596,6 +596,15 @@ public interface UpdatableRecord<R extends UpdatableRecord<R>> extends TableReco
* This returns a child record referencing this record through a given
* foreign key, as if fetching from {@link #children(ForeignKey)}.. If no
* child record was found, this returns <code>null</code>.
* <p>
* <strong>A separate roundtrip is created by this operation.</strong> It is
* often much better to include parent records using ordinary
* <code>JOIN</code> mechanisms in a single query, or using nested records,
* or the <code>MULTISET</code> or <code>MULTISET_AGG</code> operators, see
* <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/nested-records/">https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/nested-records/</a>,
* or the <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/multiset-value-constructor/">https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/multiset-value-constructor/</a>.
*
* @throws DataAccessException if something went wrong executing the query
* @throws TooManyRowsException if the query returned more than one record
@ -613,6 +622,15 @@ public interface UpdatableRecord<R extends UpdatableRecord<R>> extends TableReco
* <p>
* This returns child records referencing this record through a given
* foreign key, as if fetching from {@link #children(ForeignKey)}.
* <p>
* <strong>A separate roundtrip is created by this operation.</strong> It is
* often much better to include parent records using ordinary
* <code>JOIN</code> mechanisms in a single query, or using nested records,
* or the <code>MULTISET</code> or <code>MULTISET_AGG</code> operators, see
* <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/nested-records/">https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/nested-records/</a>,
* or the <a href=
* "https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/multiset-value-constructor/">https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/multiset-value-constructor/</a>.
*
* @throws DataAccessException if something went wrong executing the query
* @see ForeignKey#fetchChildren(java.util.Collection)