[jOOQ/jOOQ#15807] Add support for JOIN algorithm hints

This includes:

- QOM API implementation
- DSL API implementation on Table
- DSL API implementation on SelectJoinStep
- CRDB and SQL Server implementation
This commit is contained in:
Lukas Eder 2023-11-08 17:12:21 +01:00
parent ba1820d09f
commit e2ddc15ff6
8 changed files with 1791 additions and 25 deletions

View File

@ -75,6 +75,7 @@ import static org.jooq.SQLDialect.TRINO;
import static org.jooq.SQLDialect.YUGABYTEDB;
import org.jooq.impl.DSL;
import org.jooq.impl.QOM.JoinHint;
import org.jetbrains.annotations.NotNull;
@ -153,6 +154,19 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOptionalOnStep<R> join(TableLike<?> table, JoinType type);
/**
* Convenience method to join a table to the last table added to the
* <code>FROM</code> clause using {@link Table#join(TableLike, JoinType, JoinHint)}
* <p>
* Depending on the <code>JoinType</code>, a subsequent
* {@link SelectOnStep#on(Condition)} or
* {@link SelectOnStep#using(Field...)} clause is required. If it is
* required but omitted, the JOIN clause will be ignored
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> join(TableLike<?> table, JoinType type, JoinHint hint);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#join(TableLike)}.
@ -166,6 +180,45 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOnStep<R> join(TableLike<?> table);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#hashJoin(TableLike)}.
* <p>
* A synonym for {@link #innerHashJoin(TableLike)}.
*
* @see Table#hashJoin(TableLike)
* @see #innerHashJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectOnStep<R> hashJoin(TableLike<?> table);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#loopJoin(TableLike)}.
* <p>
* A synonym for {@link #innerLoopJoin(TableLike)}.
*
* @see Table#loopJoin(TableLike)
* @see #innerLoopJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectOnStep<R> loopJoin(TableLike<?> table);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#mergeJoin(TableLike)}.
* <p>
* A synonym for {@link #innerMergeJoin(TableLike)}.
*
* @see Table#mergeJoin(TableLike)
* @see #innerMergeJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectOnStep<R> mergeJoin(TableLike<?> table);
/**
* Convenience method to <code>INNER JOIN</code> a path to the last table
* added to the <code>FROM</code> clause using {@link Table#join(Path)}.
@ -179,6 +232,45 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOptionalOnStep<R> join(Path<?> path);
/**
* Convenience method to <code>INNER JOIN</code> a path to the last table
* added to the <code>FROM</code> clause using {@link Table#hashJoin(Path)}.
* <p>
* A synonym for {@link #innerHashJoin(Path)}.
*
* @see Table#hashJoin(Path)
* @see #innerHashJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> hashJoin(Path<?> path);
/**
* Convenience method to <code>INNER JOIN</code> a path to the last table
* added to the <code>FROM</code> clause using {@link Table#loopJoin(Path)}.
* <p>
* A synonym for {@link #innerLoopJoin(Path)}.
*
* @see Table#loopJoin(Path)
* @see #innerLoopJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> loopJoin(Path<?> path);
/**
* Convenience method to <code>INNER JOIN</code> a path to the last table
* added to the <code>FROM</code> clause using {@link Table#mergeJoin(Path)}.
* <p>
* A synonym for {@link #innerMergeJoin(Path)}.
*
* @see Table#mergeJoin(Path)
* @see #innerMergeJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> mergeJoin(Path<?> path);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#join(String)}.
@ -293,6 +385,36 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOnStep<R> innerJoin(TableLike<?> table);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#innerHashJoin(TableLike)}.
*
* @see Table#innerHashJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectOnStep<R> innerHashJoin(TableLike<?> table);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#innerLoopJoin(TableLike)}.
*
* @see Table#innerLoopJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectOnStep<R> innerLoopJoin(TableLike<?> table);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#innerMergeJoin(TableLike)}.
*
* @see Table#innerMergeJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectOnStep<R> innerMergeJoin(TableLike<?> table);
/**
* Convenience method to <code>INNER JOIN</code> a path to the last table
* added to the <code>FROM</code> clause using {@link Table#join(Path)}.
@ -303,6 +425,36 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOptionalOnStep<R> innerJoin(Path<?> path);
/**
* Convenience method to <code>INNER JOIN</code> a path to the last table
* added to the <code>FROM</code> clause using {@link Table#innerHashJoin(Path)}.
*
* @see Table#innerHashJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> innerHashJoin(Path<?> path);
/**
* Convenience method to <code>INNER JOIN</code> a path to the last table
* added to the <code>FROM</code> clause using {@link Table#innerLoopJoin(Path)}.
*
* @see Table#innerLoopJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> innerLoopJoin(Path<?> path);
/**
* Convenience method to <code>INNER JOIN</code> a path to the last table
* added to the <code>FROM</code> clause using {@link Table#innerMergeJoin(Path)}.
*
* @see Table#innerMergeJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> innerMergeJoin(Path<?> path);
/**
* Convenience method to <code>INNER JOIN</code> a table to the last table
* added to the <code>FROM</code> clause using {@link Table#join(String)}.
@ -548,6 +700,48 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectJoinPartitionByStep<R> leftJoin(TableLike<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterHashJoin(TableLike)}.
* <p>
* A synonym for {@link #leftOuterHashJoin(TableLike)}.
*
* @see Table#leftOuterHashJoin(TableLike)
* @see #leftOuterHashJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> leftHashJoin(TableLike<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterLoopJoin(TableLike)}.
* <p>
* A synonym for {@link #leftOuterLoopJoin(TableLike)}.
*
* @see Table#leftOuterLoopJoin(TableLike)
* @see #leftOuterLoopJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> leftLoopJoin(TableLike<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterMergeJoin(TableLike)}.
* <p>
* A synonym for {@link #leftOuterMergeJoin(TableLike)}.
*
* @see Table#leftOuterMergeJoin(TableLike)
* @see #leftOuterMergeJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> leftMergeJoin(TableLike<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
@ -562,6 +756,48 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOptionalOnStep<R> leftJoin(Path<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterHashJoin(Path)}.
* <p>
* A synonym for {@link #leftOuterHashJoin(Path)}.
*
* @see Table#leftOuterHashJoin(Path)
* @see #leftOuterHashJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> leftHashJoin(Path<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterLoopJoin(Path)}.
* <p>
* A synonym for {@link #leftOuterLoopJoin(Path)}.
*
* @see Table#leftOuterLoopJoin(Path)
* @see #leftOuterLoopJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> leftLoopJoin(Path<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterMergeJoin(Path)}.
* <p>
* A synonym for {@link #leftOuterMergeJoin(Path)}.
*
* @see Table#leftOuterMergeJoin(Path)
* @see #leftOuterMergeJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> leftMergeJoin(Path<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
@ -678,6 +914,39 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectJoinPartitionByStep<R> leftOuterJoin(TableLike<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterHashJoin(TableLike)}
*
* @see Table#leftOuterHashJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> leftOuterHashJoin(TableLike<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterLoopJoin(TableLike)}
*
* @see Table#leftOuterLoopJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> leftOuterLoopJoin(TableLike<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterMergeJoin(TableLike)}
*
* @see Table#leftOuterMergeJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> leftOuterMergeJoin(TableLike<?> table);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
@ -689,6 +958,39 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOptionalOnStep<R> leftOuterJoin(Path<?> path);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterHashJoin(Path)}
*
* @see Table#leftOuterHashJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> leftOuterHashJoin(Path<?> path);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterLoopJoin(Path)}
*
* @see Table#leftOuterLoopJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> leftOuterLoopJoin(Path<?> path);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#leftOuterMergeJoin(Path)}
*
* @see Table#leftOuterMergeJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> leftOuterMergeJoin(Path<?> path);
/**
* Convenience method to <code>LEFT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
@ -793,6 +1095,48 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectJoinPartitionByStep<R> rightJoin(TableLike<?> table);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterHashJoin(TableLike)}.
* <p>
* A synonym for {@link #rightOuterHashJoin(TableLike)}.
*
* @see Table#rightOuterHashJoin(TableLike)
* @see #rightOuterHashJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> rightHashJoin(TableLike<?> table);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterLoopJoin(TableLike)}.
* <p>
* A synonym for {@link #rightOuterLoopJoin(TableLike)}.
*
* @see Table#rightOuterLoopJoin(TableLike)
* @see #rightOuterLoopJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> rightLoopJoin(TableLike<?> table);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterMergeJoin(TableLike)}.
* <p>
* A synonym for {@link #rightOuterMergeJoin(TableLike)}.
*
* @see Table#rightOuterMergeJoin(TableLike)
* @see #rightOuterMergeJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> rightMergeJoin(TableLike<?> table);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
@ -807,6 +1151,48 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOptionalOnStep<R> rightJoin(Path<?> path);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterHashJoin(Path)}.
* <p>
* A synonym for {@link #rightOuterHashJoin(Path)}.
*
* @see Table#rightOuterHashJoin(Path)
* @see #rightOuterHashJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> rightHashJoin(Path<?> path);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterLoopJoin(Path)}.
* <p>
* A synonym for {@link #rightOuterLoopJoin(Path)}.
*
* @see Table#rightOuterLoopJoin(Path)
* @see #rightOuterLoopJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> rightLoopJoin(Path<?> path);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterMergeJoin(Path)}.
* <p>
* A synonym for {@link #rightOuterMergeJoin(Path)}.
*
* @see Table#rightOuterMergeJoin(Path)
* @see #rightOuterMergeJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> rightMergeJoin(Path<?> path);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
@ -923,6 +1309,39 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectJoinPartitionByStep<R> rightOuterJoin(TableLike<?> table);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterHashJoin(TableLike)}
*
* @see Table#rightOuterHashJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> rightOuterHashJoin(TableLike<?> table);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterLoopJoin(TableLike)}
*
* @see Table#rightOuterLoopJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> rightOuterLoopJoin(TableLike<?> table);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterMergeJoin(TableLike)}
*
* @see Table#rightOuterMergeJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support
SelectJoinPartitionByStep<R> rightOuterMergeJoin(TableLike<?> table);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
@ -934,6 +1353,39 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support
SelectOptionalOnStep<R> rightOuterJoin(Path<?> path);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterHashJoin(Path)}
*
* @see Table#rightOuterHashJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> rightOuterHashJoin(Path<?> path);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterLoopJoin(Path)}
*
* @see Table#rightOuterLoopJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> rightOuterLoopJoin(Path<?> path);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#rightOuterMergeJoin(Path)}
*
* @see Table#rightOuterMergeJoin(Path)
*/
@NotNull @CheckReturnValue
@Support
SelectOptionalOnStep<R> rightOuterMergeJoin(Path<?> path);
/**
* Convenience method to <code>RIGHT OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
@ -1035,6 +1487,39 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOnStep<R> fullJoin(TableLike<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterHashJoin(TableLike)}.
* <p>
* A synonym for {@link #fullOuterHashJoin(TableLike)}.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOnStep<R> fullHashJoin(TableLike<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterLoopJoin(TableLike)}.
* <p>
* A synonym for {@link #fullOuterLoopJoin(TableLike)}.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOnStep<R> fullLoopJoin(TableLike<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterMergeJoin(TableLike)}.
* <p>
* A synonym for {@link #fullOuterMergeJoin(TableLike)}.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOnStep<R> fullMergeJoin(TableLike<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
@ -1046,6 +1531,39 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOptionalOnStep<R> fullJoin(Path<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterHashJoin(Path)}.
* <p>
* A synonym for {@link #fullOuterHashJoin(Path)}.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOptionalOnStep<R> fullHashJoin(Path<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterLoopJoin(Path)}.
* <p>
* A synonym for {@link #fullOuterLoopJoin(Path)}.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOptionalOnStep<R> fullLoopJoin(Path<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterMergeJoin(Path)}.
* <p>
* A synonym for {@link #fullOuterMergeJoin(Path)}.
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOptionalOnStep<R> fullMergeJoin(Path<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
@ -1136,6 +1654,39 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOnStep<R> fullOuterJoin(TableLike<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterHashJoin(TableLike)}
*
* @see Table#fullOuterHashJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOnStep<R> fullOuterHashJoin(TableLike<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterLoopJoin(TableLike)}
*
* @see Table#fullOuterLoopJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOnStep<R> fullOuterLoopJoin(TableLike<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterMergeJoin(TableLike)}
*
* @see Table#fullOuterMergeJoin(TableLike)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOnStep<R> fullOuterMergeJoin(TableLike<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
@ -1147,6 +1698,39 @@ public interface SelectJoinStep<R extends Record> extends SelectWhereStep<R> {
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOptionalOnStep<R> fullOuterJoin(Path<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterHashJoin(Path)}
*
* @see Table#fullOuterHashJoin(Path)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOptionalOnStep<R> fullOuterHashJoin(Path<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterLoopJoin(Path)}
*
* @see Table#fullOuterLoopJoin(Path)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOptionalOnStep<R> fullOuterLoopJoin(Path<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a path to the last
* table added to the <code>FROM</code> clause using
* {@link Table#fullOuterMergeJoin(Path)}
*
* @see Table#fullOuterMergeJoin(Path)
*/
@NotNull @CheckReturnValue
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
SelectOptionalOnStep<R> fullOuterMergeJoin(Path<?> table);
/**
* Convenience method to <code>FULL OUTER JOIN</code> a table to the last
* table added to the <code>FROM</code> clause using

View File

@ -85,6 +85,7 @@ import java.util.Collection;
import org.jooq.exception.DataAccessException;
import org.jooq.impl.DSL;
import org.jooq.impl.QOM.JoinHint;
import org.jetbrains.annotations.NotNull;
@ -225,6 +226,66 @@ public interface SelectQuery<R extends Record> extends Select<R>, ConditionProvi
@Support
void addJoin(TableLike<?> table, JoinType type, Condition... conditions);
/**
* Joins the existing table product to a new table using a condition,
* connecting them with each other with {@link Operator#AND}.
*
* @param table The joined table
* @param type The type of join
* @param hint The hint to apply to the join
* @param condition The joining condition
*/
@Support
void addJoin(TableLike<?> table, JoinType type, JoinHint hint, Condition condition);
/**
* Joins the existing table product to a new table using a condition,
* connecting them with each other with {@link Operator#AND}.
*
* @param table The joined table
* @param type The type of join
* @param hint The hint to apply to the join
* @param conditions The joining conditions
*/
@Support
void addJoin(TableLike<?> table, JoinType type, JoinHint hint, Condition... conditions);
@ -288,6 +349,21 @@ public interface SelectQuery<R extends Record> extends Select<R>, ConditionProvi
@Support
void addJoinUsing(TableLike<?> table, JoinType type, Collection<? extends Field<?>> fields);
/**
* Joins the existing table product to a new table with a <code>USING</code>
* clause.
* <p>
* If this is not supported by your RDBMS, then jOOQ will try to emulate
* this behaviour using the information provided in this query.
*
* @param table The joined table
* @param type The type of join
* @param hint The hint to apply to the join
* @param fields The fields for the <code>USING</code> clause
*/
@Support
void addJoinUsing(TableLike<?> table, JoinType type, JoinHint hint, Collection<? extends Field<?>> fields);
/**
* Joins the existing table product to a new table using a foreign key.
*
@ -319,6 +395,39 @@ public interface SelectQuery<R extends Record> extends Select<R>, ConditionProvi
@Support
void addJoinOnKey(TableLike<?> table, JoinType type, TableField<?, ?>... keyFields) throws DataAccessException;
/**
* Joins the existing table product to a new table using a foreign key.
*
* @param table The joined table
* @param type The type of join
* @param hint The hint to apply to the join
* @see TableOnStep#onKey(ForeignKey)
* @throws DataAccessException If there is no non-ambiguous key definition
* known to jOOQ. <em>Please note that if you evolve your
* schema, a previously non-ambiguous <code>ON KEY</code> clause
* can suddenly become ambiguous on an existing query, so use
* this clause with care.</em>
*/
@Support
void addJoinOnKey(TableLike<?> table, JoinType type, JoinHint hint) throws DataAccessException;
/**
* Joins the existing table product to a new table using a foreign key.
*
* @param table The joined table
* @param type The type of join
* @param hint The hint to apply to the join
* @param keyFields The foreign key fields
* @see TableOnStep#onKey(ForeignKey)
* @throws DataAccessException If there is no non-ambiguous key definition
* known to jOOQ. <em>Please note that if you evolve your
* schema, a previously non-ambiguous <code>ON KEY</code> clause
* can suddenly become ambiguous on an existing query, so use
* this clause with care.</em>
*/
@Support
void addJoinOnKey(TableLike<?> table, JoinType type, JoinHint hint, TableField<?, ?>... keyFields) throws DataAccessException;
/**
* Joins the existing table product to a new table using a foreign key.
*
@ -330,6 +439,18 @@ public interface SelectQuery<R extends Record> extends Select<R>, ConditionProvi
@Support
void addJoinOnKey(TableLike<?> table, JoinType type, ForeignKey<?, ?> key);
/**
* Joins the existing table product to a new table using a foreign key.
*
* @param table The joined table
* @param type The type of join
* @param hint The hint to apply to the join
* @param key The foreign key
* @see TableOnStep#onKey(ForeignKey)
*/
@Support
void addJoinOnKey(TableLike<?> table, JoinType type, JoinHint hint, ForeignKey<?, ?> key);
/**
* Adds grouping fields.
* <p>

View File

@ -95,6 +95,8 @@ import org.jooq.impl.QOM.JoinHint;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import jakarta.persistence.JoinTable;
/**
* A table.
* <p>
@ -1045,6 +1047,42 @@ extends
@Support
TableOnStep<Record> join(TableLike<?> table);
/**
* <code>INNER JOIN</code> a table to this table with a
* {@link JoinHint#HASH} hint.
* <p>
* A synonym for {@link #innerHashJoin(TableLike)}.
*
* @see #innerHashJoin(TableLike)
*/
@NotNull
@Support
TableOnStep<Record> hashJoin(TableLike<?> table);
/**
* <code>INNER JOIN</code> a table to this table with a
* {@link JoinHint#LOOP} hint.
* <p>
* A synonym for {@link #innerLoopJoin(TableLike)}.
*
* @see #innerLoopJoin(TableLike)
*/
@NotNull
@Support
TableOnStep<Record> loopJoin(TableLike<?> table);
/**
* <code>INNER JOIN</code> a table to this table with a
* {@link JoinHint#MERGE} hint.
* <p>
* A synonym for {@link #innerMergeJoin(TableLike)}.
*
* @see #innerMergeJoin(TableLike)
*/
@NotNull
@Support
TableOnStep<Record> mergeJoin(TableLike<?> table);
/**
* <code>INNER JOIN</code> a path to this table.
* <p>
@ -1054,6 +1092,36 @@ extends
@Support
TableOptionalOnStep<Record> join(Path<?> path);
/**
* <code>INNER JOIN</code> a path to this table with a
* {@link JoinHint#HASH} hint.
* <p>
* A synonym for {@link #innerHashJoin(Path)}.
*/
@NotNull
@Support
TableOptionalOnStep<Record> hashJoin(Path<?> path);
/**
* <code>INNER JOIN</code> a path to this table with a
* {@link JoinHint#LOOP} hint.
* <p>
* A synonym for {@link #innerLoopJoin(Path)}.
*/
@NotNull
@Support
TableOptionalOnStep<Record> loopJoin(Path<?> path);
/**
* <code>INNER JOIN</code> a path to this table with a
* {@link JoinHint#MERGE} hint.
* <p>
* A synonym for {@link #innerMergeJoin(Path)}.
*/
@NotNull
@Support
TableOptionalOnStep<Record> mergeJoin(Path<?> path);
/**
* <code>INNER JOIN</code> a table to this table.
* <p>
@ -1152,6 +1220,30 @@ extends
@Support
TableOnStep<Record> innerJoin(TableLike<?> table);
/**
* <code>INNER JOIN</code> a table to this table with a
* {@link JoinHint#HASH} hint.
*/
@NotNull
@Support
TableOnStep<Record> innerHashJoin(TableLike<?> table);
/**
* <code>INNER JOIN</code> a table to this table with a
* {@link JoinHint#LOOP} hint.
*/
@NotNull
@Support
TableOnStep<Record> innerLoopJoin(TableLike<?> table);
/**
* <code>INNER JOIN</code> a table to this table with a
* {@link JoinHint#MERGE} hint.
*/
@NotNull
@Support
TableOnStep<Record> innerMergeJoin(TableLike<?> table);
/**
* <code>INNER JOIN</code> a path to this table.
*/
@ -1159,6 +1251,30 @@ extends
@Support
TableOptionalOnStep<Record> innerJoin(Path<?> path);
/**
* <code>INNER JOIN</code> a path to this table with a
* {@link JoinHint#HASH} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> innerHashJoin(Path<?> path);
/**
* <code>INNER JOIN</code> a path to this table with a
* {@link JoinHint#LOOP} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> innerLoopJoin(Path<?> path);
/**
* <code>INNER JOIN</code> a path to this table with a
* {@link JoinHint#MERGE} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> innerMergeJoin(Path<?> path);
/**
* <code>INNER JOIN</code> a table to this table.
* <p>
@ -1265,6 +1381,42 @@ extends
@Support
TablePartitionByStep<Record> leftJoin(TableLike<?> table);
/**
* <code>LEFT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#HASH} hint.
* <p>
* A synonym for {@link #leftOuterHashJoin(TableLike)}.
*
* @see #leftOuterHashJoin(TableLike)
*/
@NotNull
@Support
TablePartitionByStep<Record> leftHashJoin(TableLike<?> table);
/**
* <code>LEFT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#LOOP} hint.
* <p>
* A synonym for {@link #leftOuterLoopJoin(TableLike)}.
*
* @see #leftOuterLoopJoin(TableLike)
*/
@NotNull
@Support
TablePartitionByStep<Record> leftLoopJoin(TableLike<?> table);
/**
* <code>LEFT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#MERGE} hint.
* <p>
* A synonym for {@link #leftOuterMergeJoin(TableLike)}.
*
* @see #leftOuterMergeJoin(TableLike)
*/
@NotNull
@Support
TablePartitionByStep<Record> leftMergeJoin(TableLike<?> table);
/**
* <code>LEFT OUTER JOIN</code> a path to this table.
* <p>
@ -1276,6 +1428,42 @@ extends
@Support
TableOptionalOnStep<Record> leftJoin(Path<?> path);
/**
* <code>LEFT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#HASH} hint.
* <p>
* A synonym for {@link #leftOuterHashJoin(Path)}.
*
* @see #leftOuterHashJoin(Path)
*/
@NotNull
@Support
TableOptionalOnStep<Record> leftHashJoin(Path<?> path);
/**
* <code>LEFT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#LOOP} hint.
* <p>
* A synonym for {@link #leftOuterLoopJoin(Path)}.
*
* @see #leftOuterLoopJoin(Path)
*/
@NotNull
@Support
TableOptionalOnStep<Record> leftLoopJoin(Path<?> path);
/**
* <code>LEFT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#MERGE} hint.
* <p>
* A synonym for {@link #leftOuterMergeJoin(Path)}.
*
* @see #leftOuterMergeJoin(Path)
*/
@NotNull
@Support
TableOptionalOnStep<Record> leftMergeJoin(Path<?> path);
/**
* <code>LEFT OUTER JOIN</code> a table to this table.
* <p>
@ -1373,6 +1561,30 @@ extends
@Support
TablePartitionByStep<Record> leftOuterJoin(TableLike<?> table);
/**
* <code>LEFT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#HASH} hint.
*/
@NotNull
@Support
TablePartitionByStep<Record> leftOuterHashJoin(TableLike<?> table);
/**
* <code>LEFT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#LOOP} hint.
*/
@NotNull
@Support
TablePartitionByStep<Record> leftOuterLoopJoin(TableLike<?> table);
/**
* <code>LEFT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#MERGE} hint.
*/
@NotNull
@Support
TablePartitionByStep<Record> leftOuterMergeJoin(TableLike<?> table);
/**
* <code>LEFT OUTER JOIN</code> a path to this table.
*/
@ -1380,6 +1592,30 @@ extends
@Support
TableOptionalOnStep<Record> leftOuterJoin(Path<?> path);
/**
* <code>LEFT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#HASH} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> leftOuterHashJoin(Path<?> path);
/**
* <code>LEFT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#LOOP} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> leftOuterLoopJoin(Path<?> path);
/**
* <code>LEFT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#MERGE} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> leftOuterMergeJoin(Path<?> path);
/**
* <code>LEFT OUTER JOIN</code> a table to this table.
* <p>
@ -1467,6 +1703,42 @@ extends
@Support
TablePartitionByStep<Record> rightJoin(TableLike<?> table);
/**
* <code>RIGHT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#HASH} hint.
* <p>
* A synonym for {@link #rightOuterHashJoin(TableLike)}.
*
* @see #rightOuterHashJoin(TableLike)
*/
@NotNull
@Support
TablePartitionByStep<Record> rightHashJoin(TableLike<?> table);
/**
* <code>RIGHT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#LOOP} hint.
* <p>
* A synonym for {@link #rightOuterLoopJoin(TableLike)}.
*
* @see #rightOuterLoopJoin(TableLike)
*/
@NotNull
@Support
TablePartitionByStep<Record> rightLoopJoin(TableLike<?> table);
/**
* <code>RIGHT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#MERGE} hint.
* <p>
* A synonym for {@link #rightOuterMergeJoin(TableLike)}.
*
* @see #rightOuterMergeJoin(TableLike)
*/
@NotNull
@Support
TablePartitionByStep<Record> rightMergeJoin(TableLike<?> table);
/**
* <code>RIGHT OUTER JOIN</code> a path to this table.
* <p>
@ -1478,6 +1750,42 @@ extends
@Support
TableOptionalOnStep<Record> rightJoin(Path<?> path);
/**
* <code>RIGHT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#HASH} hint.
* <p>
* A synonym for {@link #rightOuterHashJoin(Path)}.
*
* @see #rightOuterHashJoin(Path)
*/
@NotNull
@Support
TableOptionalOnStep<Record> rightHashJoin(Path<?> path);
/**
* <code>RIGHT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#LOOP} hint.
* <p>
* A synonym for {@link #rightOuterLoopJoin(Path)}.
*
* @see #rightOuterLoopJoin(Path)
*/
@NotNull
@Support
TableOptionalOnStep<Record> rightLoopJoin(Path<?> path);
/**
* <code>RIGHT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#MERGE} hint.
* <p>
* A synonym for {@link #rightOuterMergeJoin(Path)}.
*
* @see #rightOuterMergeJoin(Path)
*/
@NotNull
@Support
TableOptionalOnStep<Record> rightMergeJoin(Path<?> path);
/**
* <code>RIGHT OUTER JOIN</code> a table to this table.
* <p>
@ -1575,6 +1883,30 @@ extends
@Support
TablePartitionByStep<Record> rightOuterJoin(TableLike<?> table);
/**
* <code>RIGHT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#HASH} hint.
*/
@NotNull
@Support
TablePartitionByStep<Record> rightOuterHashJoin(TableLike<?> table);
/**
* <code>RIGHT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#LOOP} hint.
*/
@NotNull
@Support
TablePartitionByStep<Record> rightOuterLoopJoin(TableLike<?> table);
/**
* <code>RIGHT OUTER JOIN</code> a table to this table with a
* {@link JoinHint#MERGE} hint.
*/
@NotNull
@Support
TablePartitionByStep<Record> rightOuterMergeJoin(TableLike<?> table);
/**
* <code>RIGHT OUTER JOIN</code> a path to this table.
*/
@ -1582,6 +1914,30 @@ extends
@Support
TableOptionalOnStep<Record> rightOuterJoin(Path<?> path);
/**
* <code>RIGHT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#HASH} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> rightOuterHashJoin(Path<?> path);
/**
* <code>RIGHT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#LOOP} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> rightOuterLoopJoin(Path<?> path);
/**
* <code>RIGHT OUTER JOIN</code> a path to this table with a
* {@link JoinHint#MERGE} hint.
*/
@NotNull
@Support
TableOptionalOnStep<Record> rightOuterMergeJoin(Path<?> path);
/**
* <code>RIGHT OUTER JOIN</code> a table to this table.
* <p>
@ -1666,6 +2022,36 @@ extends
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TablePartitionByStep<Record> fullJoin(TableLike<?> table);
/**
* <code>FULL OUTER JOIN</code> a table to this table with a
* {@link JoinHint#HASH} hint.
* <p>
* A synonym for {@link #fullOuterHashJoin(TableLike)}.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TablePartitionByStep<Record> fullHashJoin(TableLike<?> table);
/**
* <code>FULL OUTER JOIN</code> a table to this table with a
* {@link JoinHint#LOOP} hint.
* <p>
* A synonym for {@link #fullOuterLoopJoin(TableLike)}.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TablePartitionByStep<Record> fullLoopJoin(TableLike<?> table);
/**
* <code>FULL OUTER JOIN</code> a table to this table with a
* {@link JoinHint#MERGE} hint.
* <p>
* A synonym for {@link #fullOuterMergeJoin(TableLike)}.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TablePartitionByStep<Record> fullMergeJoin(TableLike<?> table);
/**
* <code>FULL OUTER JOIN</code> a path to this table.
* <p>
@ -1675,6 +2061,36 @@ extends
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TableOptionalOnStep<Record> fullJoin(Path<?> path);
/**
* <code>FULL OUTER JOIN</code> a path to this table with a
* {@link JoinHint#HASH} hint.
* <p>
* A synonym for {@link #fullOuterHashJoin(Path)}.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TableOptionalOnStep<Record> fullHashJoin(Path<?> path);
/**
* <code>FULL OUTER JOIN</code> a path to this table with a
* {@link JoinHint#LOOP} hint.
* <p>
* A synonym for {@link #fullOuterLoopJoin(Path)}.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TableOptionalOnStep<Record> fullLoopJoin(Path<?> path);
/**
* <code>FULL OUTER JOIN</code> a path to this table with a
* {@link JoinHint#MERGE} hint.
* <p>
* A synonym for {@link #fullOuterMergeJoin(Path)}.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TableOptionalOnStep<Record> fullMergeJoin(Path<?> path);
/**
* <code>FULL OUTER JOIN</code> a table to this table.
* <p>
@ -1751,6 +2167,30 @@ extends
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TablePartitionByStep<Record> fullOuterJoin(TableLike<?> table);
/**
* <code>FULL OUTER JOIN</code> a table to this table with a
* {@link JoinHint#HASH} hint.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TablePartitionByStep<Record> fullOuterHashJoin(TableLike<?> table);
/**
* <code>FULL OUTER JOIN</code> a table to this table with a
* {@link JoinHint#LOOP} hint.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TablePartitionByStep<Record> fullOuterLoopJoin(TableLike<?> table);
/**
* <code>FULL OUTER JOIN</code> a table to this table with a
* {@link JoinHint#MERGE} hint.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TablePartitionByStep<Record> fullOuterMergeJoin(TableLike<?> table);
/**
* <code>FULL OUTER JOIN</code> a path to this table.
*/
@ -1758,6 +2198,30 @@ extends
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TableOptionalOnStep<Record> fullOuterJoin(Path<?> path);
/**
* <code>FULL OUTER JOIN</code> a path to this table with a
* {@link JoinHint#HASH} hint.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TableOptionalOnStep<Record> fullOuterHashJoin(Path<?> path);
/**
* <code>FULL OUTER JOIN</code> a path to this table with a
* {@link JoinHint#LOOP} hint.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TableOptionalOnStep<Record> fullOuterLoopJoin(Path<?> path);
/**
* <code>FULL OUTER JOIN</code> a path to this table with a
* {@link JoinHint#MERGE} hint.
*/
@NotNull
@Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB })
TableOptionalOnStep<Record> fullOuterMergeJoin(Path<?> path);
/**
* <code>FULL OUTER JOIN</code> a table to this table.
* <p>

View File

@ -60,6 +60,9 @@ import static org.jooq.impl.DSL.notExists;
import static org.jooq.impl.DSL.sql;
import static org.jooq.impl.DSL.table;
import static org.jooq.impl.DSL.val;
import static org.jooq.impl.QOM.JoinHint.HASH;
import static org.jooq.impl.QOM.JoinHint.LOOP;
import static org.jooq.impl.QOM.JoinHint.MERGE;
import static org.jooq.impl.Tools.EMPTY_FIELD;
import static org.jooq.impl.Tools.EMPTY_NAME;
import static org.jooq.impl.Tools.map;
@ -1371,11 +1374,11 @@ implements
if (this instanceof NoTable)
return new NoTableJoin(table.asTable());
else if (this instanceof NoTableJoin n)
return n.table.join(table, type);
return n.table.join(table, type, hint);
else if (table instanceof NoTable)
return new NoTableJoin(this);
else if (table instanceof NoTableJoin n)
return join(n.table, type);
return join(n.table, type, hint);
switch (type) {
case CROSS_APPLY:
@ -1416,11 +1419,41 @@ implements
return innerJoin(table);
}
@Override
public final TableOnStep<Record> hashJoin(TableLike<?> table) {
return innerHashJoin(table);
}
@Override
public final TableOnStep<Record> loopJoin(TableLike<?> table) {
return innerLoopJoin(table);
}
@Override
public final TableOnStep<Record> mergeJoin(TableLike<?> table) {
return innerMergeJoin(table);
}
@Override
public final TableOptionalOnStep<Record> join(Path<?> path) {
return innerJoin(path);
}
@Override
public final TableOptionalOnStep<Record> hashJoin(Path<?> path) {
return innerHashJoin(path);
}
@Override
public final TableOptionalOnStep<Record> loopJoin(Path<?> path) {
return innerLoopJoin(path);
}
@Override
public final TableOptionalOnStep<Record> mergeJoin(Path<?> path) {
return innerMergeJoin(path);
}
@Override
public final TableOnStep<Record> join(SQL sql) {
return innerJoin(sql);
@ -1451,11 +1484,41 @@ implements
return join(table, JOIN);
}
@Override
public final TableOnStep<Record> innerHashJoin(TableLike<?> table) {
return join(table, JOIN, HASH);
}
@Override
public final TableOnStep<Record> innerLoopJoin(TableLike<?> table) {
return join(table, JOIN, LOOP);
}
@Override
public final TableOnStep<Record> innerMergeJoin(TableLike<?> table) {
return join(table, JOIN, MERGE);
}
@Override
public final TableOptionalOnStep<Record> innerJoin(Path<?> path) {
return join(path, JOIN);
}
@Override
public final TableOptionalOnStep<Record> innerHashJoin(Path<?> path) {
return join(path, JOIN, HASH);
}
@Override
public final TableOptionalOnStep<Record> innerLoopJoin(Path<?> path) {
return join(path, JOIN, LOOP);
}
@Override
public final TableOptionalOnStep<Record> innerMergeJoin(Path<?> path) {
return join(path, JOIN, MERGE);
}
@Override
public final TableOnStep<Record> innerJoin(SQL sql) {
return innerJoin(table(sql));
@ -1500,11 +1563,41 @@ implements
return leftOuterJoin(table);
}
@Override
public final TablePartitionByStep<Record> leftHashJoin(TableLike<?> table) {
return leftOuterHashJoin(table);
}
@Override
public final TablePartitionByStep<Record> leftLoopJoin(TableLike<?> table) {
return leftOuterLoopJoin(table);
}
@Override
public final TablePartitionByStep<Record> leftMergeJoin(TableLike<?> table) {
return leftOuterMergeJoin(table);
}
@Override
public final TableOptionalOnStep<Record> leftJoin(Path<?> path) {
return leftOuterJoin(path);
}
@Override
public final TableOptionalOnStep<Record> leftHashJoin(Path<?> path) {
return leftOuterHashJoin(path);
}
@Override
public final TableOptionalOnStep<Record> leftLoopJoin(Path<?> path) {
return leftOuterLoopJoin(path);
}
@Override
public final TableOptionalOnStep<Record> leftMergeJoin(Path<?> path) {
return leftOuterMergeJoin(path);
}
@Override
public final TablePartitionByStep<Record> leftJoin(SQL sql) {
return leftOuterJoin(sql);
@ -1536,11 +1629,44 @@ implements
return (TablePartitionByStep<Record>) join(table, LEFT_OUTER_JOIN);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> leftOuterHashJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, LEFT_OUTER_JOIN, HASH);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> leftOuterLoopJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, LEFT_OUTER_JOIN, LOOP);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> leftOuterMergeJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, LEFT_OUTER_JOIN, MERGE);
}
@Override
public final TableOptionalOnStep<Record> leftOuterJoin(Path<?> path) {
return join(path, LEFT_OUTER_JOIN);
}
@Override
public final TableOptionalOnStep<Record> leftOuterHashJoin(Path<?> path) {
return join(path, LEFT_OUTER_JOIN, HASH);
}
@Override
public final TableOptionalOnStep<Record> leftOuterLoopJoin(Path<?> path) {
return join(path, LEFT_OUTER_JOIN, LOOP);
}
@Override
public final TableOptionalOnStep<Record> leftOuterMergeJoin(Path<?> path) {
return join(path, LEFT_OUTER_JOIN, MERGE);
}
@Override
public final TablePartitionByStep<Record> leftOuterJoin(SQL sql) {
return leftOuterJoin(table(sql));
@ -1571,11 +1697,41 @@ implements
return rightOuterJoin(table);
}
@Override
public final TablePartitionByStep<Record> rightHashJoin(TableLike<?> table) {
return rightOuterHashJoin(table);
}
@Override
public final TablePartitionByStep<Record> rightLoopJoin(TableLike<?> table) {
return rightOuterLoopJoin(table);
}
@Override
public final TablePartitionByStep<Record> rightMergeJoin(TableLike<?> table) {
return rightOuterMergeJoin(table);
}
@Override
public final TableOptionalOnStep<Record> rightJoin(Path<?> path) {
return rightOuterJoin(path);
}
@Override
public final TableOptionalOnStep<Record> rightHashJoin(Path<?> path) {
return rightOuterHashJoin(path);
}
@Override
public final TableOptionalOnStep<Record> rightLoopJoin(Path<?> path) {
return rightOuterLoopJoin(path);
}
@Override
public final TableOptionalOnStep<Record> rightMergeJoin(Path<?> path) {
return rightOuterMergeJoin(path);
}
@Override
public final TablePartitionByStep<Record> rightJoin(SQL sql) {
return rightOuterJoin(sql);
@ -1607,11 +1763,44 @@ implements
return (TablePartitionByStep<Record>) join(table, RIGHT_OUTER_JOIN);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> rightOuterHashJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, RIGHT_OUTER_JOIN, HASH);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> rightOuterLoopJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, RIGHT_OUTER_JOIN, LOOP);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> rightOuterMergeJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, RIGHT_OUTER_JOIN, MERGE);
}
@Override
public final TableOptionalOnStep<Record> rightOuterJoin(Path<?> path) {
return join(path, RIGHT_OUTER_JOIN);
}
@Override
public final TableOptionalOnStep<Record> rightOuterHashJoin(Path<?> path) {
return join(path, RIGHT_OUTER_JOIN, HASH);
}
@Override
public final TableOptionalOnStep<Record> rightOuterLoopJoin(Path<?> path) {
return join(path, RIGHT_OUTER_JOIN, LOOP);
}
@Override
public final TableOptionalOnStep<Record> rightOuterMergeJoin(Path<?> path) {
return join(path, RIGHT_OUTER_JOIN, MERGE);
}
@Override
public final TablePartitionByStep<Record> rightOuterJoin(SQL sql) {
return rightOuterJoin(table(sql));
@ -1643,11 +1832,44 @@ implements
return (TablePartitionByStep<Record>) join(table, FULL_OUTER_JOIN);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> fullOuterHashJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, FULL_OUTER_JOIN, HASH);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> fullOuterLoopJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, FULL_OUTER_JOIN, LOOP);
}
@SuppressWarnings("unchecked")
@Override
public final TablePartitionByStep<Record> fullOuterMergeJoin(TableLike<?> table) {
return (TablePartitionByStep<Record>) join(table, FULL_OUTER_JOIN, MERGE);
}
@Override
public final TableOptionalOnStep<Record> fullOuterJoin(Path<?> path) {
return join(path, FULL_OUTER_JOIN);
}
@Override
public final TableOptionalOnStep<Record> fullOuterHashJoin(Path<?> path) {
return join(path, FULL_OUTER_JOIN, HASH);
}
@Override
public final TableOptionalOnStep<Record> fullOuterLoopJoin(Path<?> path) {
return join(path, FULL_OUTER_JOIN, LOOP);
}
@Override
public final TableOptionalOnStep<Record> fullOuterMergeJoin(Path<?> path) {
return join(path, FULL_OUTER_JOIN, MERGE);
}
@Override
public final TablePartitionByStep<Record> fullOuterJoin(SQL sql) {
return fullOuterJoin(table(sql));
@ -1678,11 +1900,41 @@ implements
return fullOuterJoin(table);
}
@Override
public final TablePartitionByStep<Record> fullHashJoin(TableLike<?> table) {
return fullOuterHashJoin(table);
}
@Override
public final TablePartitionByStep<Record> fullLoopJoin(TableLike<?> table) {
return fullOuterLoopJoin(table);
}
@Override
public final TablePartitionByStep<Record> fullMergeJoin(TableLike<?> table) {
return fullOuterMergeJoin(table);
}
@Override
public final TableOptionalOnStep<Record> fullJoin(Path<?> path) {
return fullOuterJoin(path);
}
@Override
public final TableOptionalOnStep<Record> fullHashJoin(Path<?> path) {
return fullOuterHashJoin(path);
}
@Override
public final TableOptionalOnStep<Record> fullLoopJoin(Path<?> path) {
return fullOuterLoopJoin(path);
}
@Override
public final TableOptionalOnStep<Record> fullMergeJoin(Path<?> path) {
return fullOuterMergeJoin(path);
}
@Override
public final TablePartitionByStep<Record> fullJoin(SQL sql) {
return fullOuterJoin(sql);

View File

@ -235,15 +235,15 @@ abstract class JoinTable<J extends JoinTable<J>> extends AbstractJoinTable<J> {
else if (rhs instanceof Lateral && path(((Lateral<?>) rhs).$arg1()) != null)
ctx.visit($table2(lateral(selectFrom(((Lateral<?>) rhs).$arg1()).asTable(((Lateral<?>) rhs).$arg1()))));
else if (type == NATURAL_JOIN && path)
ctx.visit(lhs.join(rhs).on(naturalCondition()));
ctx.visit(lhs.join(rhs, JOIN, hint).on(naturalCondition()));
else if (type == NATURAL_LEFT_OUTER_JOIN && path)
ctx.visit(lhs.leftJoin(rhs).on(naturalCondition()));
ctx.visit(lhs.join(rhs, LEFT_OUTER_JOIN, hint).on(naturalCondition()));
else if (type == NATURAL_RIGHT_OUTER_JOIN && path)
ctx.visit(lhs.rightJoin(rhs).on(naturalCondition()));
ctx.visit(lhs.join(rhs, RIGHT_OUTER_JOIN, hint).on(naturalCondition()));
else if (type == NATURAL_FULL_OUTER_JOIN && path)
ctx.visit(lhs.fullJoin(rhs).on(naturalCondition()));
ctx.visit(lhs.join(rhs, FULL_OUTER_JOIN, hint).on(naturalCondition()));
else if (!using.isEmpty() && path)
ctx.visit(lhs.join(rhs, type).on(usingCondition()));
ctx.visit(lhs.join(rhs, type, hint).on(usingCondition()));
// [#14988] Make sure APPLY table reference continues working by wrapping lateral(rhs)
else if (this instanceof CrossApply && EMULATE_APPLY.contains(ctx.dialect()))
@ -420,6 +420,10 @@ abstract class JoinTable<J extends JoinTable<J>> extends AbstractJoinTable<J> {
else
keyword = translatedType.toKeyword();
@ -450,9 +454,44 @@ abstract class JoinTable<J extends JoinTable<J>> extends AbstractJoinTable<J> {
break;
}
return keyword;
}
private void toSQLTable(Context<?> ctx, Table<?> table) {
// [#671] Some databases formally require nested JOINS on the right hand

View File

@ -41,7 +41,6 @@ import org.jooq.Context;
import org.jooq.Keyword;
import org.jooq.conf.RenderKeywordCase;
import org.jooq.conf.SettingsTools;
import org.jooq.impl.QOM.UEmpty;
import org.jooq.impl.QOM.UTransient;
/**

View File

@ -42,6 +42,9 @@ import static org.jooq.impl.DSL.exists;
import static org.jooq.impl.DSL.noCondition;
import static org.jooq.impl.DSL.notExists;
import static org.jooq.impl.DSL.table;
import static org.jooq.impl.QOM.JoinHint.HASH;
import static org.jooq.impl.QOM.JoinHint.LOOP;
import static org.jooq.impl.QOM.JoinHint.MERGE;
import static org.jooq.impl.Tools.EMPTY_FIELD;
import static org.jooq.impl.Tools.map;
@ -133,6 +136,7 @@ import org.jooq.TableField;
import org.jooq.TableLike;
// ...
import org.jooq.WindowDefinition;
import org.jooq.impl.QOM.JoinHint;
import org.jooq.impl.QOM.UnmodifiableList;
import org.jooq.impl.QOM.With;
@ -219,6 +223,11 @@ implements
*/
private transient JoinType joinType;
/**
* A temporary member holding a join hint
*/
private transient JoinHint joinHint;
/**
* A temporary member holding a join condition
*/
@ -2155,11 +2164,12 @@ implements
getQuery().addJoin(joinTable, joinType, joinConditions);
getQuery().addJoin(joinTable, joinType, joinHint, joinConditions);
joinTable = null;
joinPartitionBy = null;
joinType = null;
joinHint = null;
}
return this;
@ -2181,11 +2191,12 @@ implements
getQuery().addJoin(joinTable, joinType, new Condition[] { joinConditions });
getQuery().addJoin(joinTable, joinType, joinHint, new Condition[] { joinConditions });
joinTable = null;
joinPartitionBy = null;
joinType = null;
joinHint = null;
}
return this;
@ -2221,12 +2232,13 @@ implements
conditionStep = ConditionStep.ON;
if (joinTable != null) {
getQuery().addJoinOnKey(joinTable, joinType);
getQuery().addJoinOnKey(joinTable, joinType, joinHint);
joinConditions = ((JoinTable) getDelegate().getFrom().get(getDelegate().getFrom().size() - 1)).condition;
joinTable = null;
joinPartitionBy = null;
joinType = null;
joinHint = null;
}
return this;
@ -2237,12 +2249,13 @@ implements
conditionStep = ConditionStep.ON;
if (joinTable != null) {
getQuery().addJoinOnKey(joinTable, joinType, keyFields);
getQuery().addJoinOnKey(joinTable, joinType, joinHint, keyFields);
joinConditions = ((JoinTable) getDelegate().getFrom().get(getDelegate().getFrom().size() - 1)).condition;
joinTable = null;
joinPartitionBy = null;
joinType = null;
joinHint = null;
}
return this;
@ -2253,12 +2266,13 @@ implements
conditionStep = ConditionStep.ON;
if (joinTable != null) {
getQuery().addJoinOnKey(joinTable, joinType, key);
getQuery().addJoinOnKey(joinTable, joinType, joinHint, key);
joinConditions = ((JoinTable) getDelegate().getFrom().get(getDelegate().getFrom().size() - 1)).condition;
joinTable = null;
joinPartitionBy = null;
joinType = null;
joinHint = null;
}
return this;
@ -2272,10 +2286,11 @@ implements
@Override
public final SelectImpl using(Collection<? extends Field<?>> fields) {
if (joinTable != null) {
getQuery().addJoinUsing(joinTable, joinType, fields);
getQuery().addJoinUsing(joinTable, joinType, joinHint, fields);
joinTable = null;
joinPartitionBy = null;
joinType = null;
joinHint = null;
}
return this;
@ -2286,83 +2301,328 @@ implements
return innerJoin(table);
}
@Override
public final SelectImpl hashJoin(TableLike<?> table) {
return innerHashJoin(table);
}
@Override
public final SelectImpl loopJoin(TableLike<?> table) {
return innerLoopJoin(table);
}
@Override
public final SelectImpl mergeJoin(TableLike<?> table) {
return innerMergeJoin(table);
}
@Override
public final SelectImpl join(Path<?> path) {
return innerJoin(path);
}
@Override
public final SelectImpl hashJoin(Path<?> path) {
return innerHashJoin(path);
}
@Override
public final SelectImpl mergeJoin(Path<?> path) {
return innerMergeJoin(path);
}
@Override
public final SelectImpl loopJoin(Path<?> path) {
return innerLoopJoin(path);
}
@Override
public final SelectImpl innerJoin(TableLike<?> table) {
return join(table, JoinType.JOIN);
}
@Override
public final SelectImpl innerHashJoin(TableLike<?> table) {
return join(table, JoinType.JOIN, HASH);
}
@Override
public final SelectImpl innerLoopJoin(TableLike<?> table) {
return join(table, JoinType.JOIN, LOOP);
}
@Override
public final SelectImpl innerMergeJoin(TableLike<?> table) {
return join(table, JoinType.JOIN, MERGE);
}
@Override
public final SelectImpl innerJoin(Path<?> path) {
return join(path, JoinType.JOIN).on(noCondition());
}
@Override
public final SelectImpl innerHashJoin(Path<?> path) {
return join(path, JoinType.JOIN, HASH).on(noCondition());
}
@Override
public final SelectImpl innerLoopJoin(Path<?> path) {
return join(path, JoinType.JOIN, LOOP).on(noCondition());
}
@Override
public final SelectImpl innerMergeJoin(Path<?> path) {
return join(path, JoinType.JOIN, MERGE).on(noCondition());
}
@Override
public final SelectImpl leftJoin(TableLike<?> table) {
return leftOuterJoin(table);
}
@Override
public final SelectImpl leftHashJoin(TableLike<?> table) {
return leftOuterHashJoin(table);
}
@Override
public final SelectImpl leftLoopJoin(TableLike<?> table) {
return leftOuterLoopJoin(table);
}
@Override
public final SelectImpl leftMergeJoin(TableLike<?> table) {
return leftOuterMergeJoin(table);
}
@Override
public final SelectImpl leftJoin(Path<?> path) {
return leftOuterJoin(path);
}
@Override
public final SelectImpl leftHashJoin(Path<?> path) {
return leftOuterHashJoin(path);
}
@Override
public final SelectImpl leftLoopJoin(Path<?> path) {
return leftOuterLoopJoin(path);
}
@Override
public final SelectImpl leftMergeJoin(Path<?> path) {
return leftOuterMergeJoin(path);
}
@Override
public final SelectImpl leftOuterJoin(TableLike<?> table) {
return join(table, JoinType.LEFT_OUTER_JOIN);
}
@Override
public final SelectImpl leftOuterHashJoin(TableLike<?> table) {
return join(table, JoinType.LEFT_OUTER_JOIN, HASH);
}
@Override
public final SelectImpl leftOuterLoopJoin(TableLike<?> table) {
return join(table, JoinType.LEFT_OUTER_JOIN, LOOP);
}
@Override
public final SelectImpl leftOuterMergeJoin(TableLike<?> table) {
return join(table, JoinType.LEFT_OUTER_JOIN, MERGE);
}
@Override
public final SelectImpl leftOuterJoin(Path<?> path) {
return join(path, JoinType.LEFT_OUTER_JOIN).on(noCondition());
}
@Override
public final SelectImpl leftOuterHashJoin(Path<?> path) {
return join(path, JoinType.LEFT_OUTER_JOIN, HASH).on(noCondition());
}
@Override
public final SelectImpl leftOuterLoopJoin(Path<?> path) {
return join(path, JoinType.LEFT_OUTER_JOIN, LOOP).on(noCondition());
}
@Override
public final SelectImpl leftOuterMergeJoin(Path<?> path) {
return join(path, JoinType.LEFT_OUTER_JOIN, MERGE).on(noCondition());
}
@Override
public final SelectImpl rightJoin(TableLike<?> table) {
return rightOuterJoin(table);
}
@Override
public final SelectImpl rightHashJoin(TableLike<?> table) {
return rightOuterHashJoin(table);
}
@Override
public final SelectImpl rightLoopJoin(TableLike<?> table) {
return rightOuterLoopJoin(table);
}
@Override
public final SelectImpl rightMergeJoin(TableLike<?> table) {
return rightOuterMergeJoin(table);
}
@Override
public final SelectImpl rightJoin(Path<?> path) {
return rightOuterJoin(path);
}
@Override
public final SelectImpl rightHashJoin(Path<?> path) {
return rightOuterHashJoin(path);
}
@Override
public final SelectImpl rightLoopJoin(Path<?> path) {
return rightOuterLoopJoin(path);
}
@Override
public final SelectImpl rightMergeJoin(Path<?> path) {
return rightOuterMergeJoin(path);
}
@Override
public final SelectImpl rightOuterJoin(TableLike<?> table) {
return join(table, JoinType.RIGHT_OUTER_JOIN);
}
@Override
public final SelectImpl rightOuterHashJoin(TableLike<?> table) {
return join(table, JoinType.RIGHT_OUTER_JOIN, HASH);
}
@Override
public final SelectImpl rightOuterLoopJoin(TableLike<?> table) {
return join(table, JoinType.RIGHT_OUTER_JOIN, LOOP);
}
@Override
public final SelectImpl rightOuterMergeJoin(TableLike<?> table) {
return join(table, JoinType.RIGHT_OUTER_JOIN, MERGE);
}
@Override
public final SelectImpl rightOuterJoin(Path<?> path) {
return join(path, JoinType.RIGHT_OUTER_JOIN).on(noCondition());
}
@Override
public final SelectImpl rightOuterHashJoin(Path<?> path) {
return join(path, JoinType.RIGHT_OUTER_JOIN, HASH).on(noCondition());
}
@Override
public final SelectImpl rightOuterLoopJoin(Path<?> path) {
return join(path, JoinType.RIGHT_OUTER_JOIN, LOOP).on(noCondition());
}
@Override
public final SelectImpl rightOuterMergeJoin(Path<?> path) {
return join(path, JoinType.RIGHT_OUTER_JOIN, MERGE).on(noCondition());
}
@Override
public final SelectImpl fullJoin(TableLike<?> table) {
return fullOuterJoin(table);
}
@Override
public final SelectImpl fullHashJoin(TableLike<?> table) {
return fullOuterHashJoin(table);
}
@Override
public final SelectImpl fullLoopJoin(TableLike<?> table) {
return fullOuterLoopJoin(table);
}
@Override
public final SelectImpl fullMergeJoin(TableLike<?> table) {
return fullOuterMergeJoin(table);
}
@Override
public final SelectImpl fullJoin(Path<?> path) {
return fullOuterJoin(path);
}
@Override
public final SelectImpl fullHashJoin(Path<?> path) {
return fullOuterHashJoin(path);
}
@Override
public final SelectImpl fullLoopJoin(Path<?> path) {
return fullOuterLoopJoin(path);
}
@Override
public final SelectImpl fullMergeJoin(Path<?> path) {
return fullOuterMergeJoin(path);
}
@Override
public final SelectImpl fullOuterJoin(TableLike<?> table) {
return join(table, JoinType.FULL_OUTER_JOIN);
}
@Override
public final SelectImpl fullOuterHashJoin(TableLike<?> table) {
return join(table, JoinType.FULL_OUTER_JOIN, HASH);
}
@Override
public final SelectImpl fullOuterLoopJoin(TableLike<?> table) {
return join(table, JoinType.FULL_OUTER_JOIN, LOOP);
}
@Override
public final SelectImpl fullOuterMergeJoin(TableLike<?> table) {
return join(table, JoinType.FULL_OUTER_JOIN, MERGE);
}
@Override
public final SelectImpl fullOuterJoin(Path<?> path) {
return join(path, JoinType.FULL_OUTER_JOIN).on(noCondition());
}
@Override
public final SelectImpl fullOuterHashJoin(Path<?> path) {
return join(path, JoinType.FULL_OUTER_JOIN, HASH).on(noCondition());
}
@Override
public final SelectImpl fullOuterLoopJoin(Path<?> path) {
return join(path, JoinType.FULL_OUTER_JOIN, LOOP).on(noCondition());
}
@Override
public final SelectImpl fullOuterMergeJoin(Path<?> path) {
return join(path, JoinType.FULL_OUTER_JOIN, MERGE).on(noCondition());
}
@Override
public final SelectImpl join(TableLike<?> table, JoinType type) {
return join(table, type, null);
}
@Override
public final SelectImpl join(TableLike<?> table, JoinType type, JoinHint hint) {
switch (type) {
case CROSS_JOIN:
case NATURAL_JOIN:
@ -2371,10 +2631,11 @@ implements
case NATURAL_FULL_OUTER_JOIN:
case CROSS_APPLY:
case OUTER_APPLY: {
getQuery().addJoin(table, type);
getQuery().addJoin(table, type, hint);
joinTable = null;
joinPartitionBy = null;
joinType = null;
joinHint = null;
return this;
}
@ -2383,6 +2644,7 @@ implements
conditionStep = ConditionStep.ON;
joinTable = table;
joinType = type;
joinHint = hint;
joinPartitionBy = null;
joinConditions = null;

View File

@ -317,6 +317,7 @@ import org.jooq.exception.DataAccessException;
import org.jooq.impl.ForLock.ForLockMode;
import org.jooq.impl.ForLock.ForLockWaitMode;
import org.jooq.impl.QOM.CompareCondition;
import org.jooq.impl.QOM.JoinHint;
import org.jooq.impl.QOM.Materialized;
import org.jooq.impl.QOM.UnmodifiableList;
import org.jooq.impl.QOM.With;
@ -4681,12 +4682,22 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
@Override
public final void addJoin(TableLike<?> table, JoinType type, Condition conditions) {
addJoin0(table, type, conditions, null);
addJoin0(table, type, null, conditions, null);
}
@Override
public final void addJoin(TableLike<?> table, JoinType type, Condition... conditions) {
addJoin0(table, type, conditions, null);
addJoin0(table, type, null, conditions, null);
}
@Override
public final void addJoin(TableLike<?> table, JoinType type, JoinHint hint, Condition conditions) {
addJoin0(table, type, hint, conditions, null);
}
@Override
public final void addJoin(TableLike<?> table, JoinType type, JoinHint hint, Condition... conditions) {
addJoin0(table, type, hint, conditions, null);
}
@ -4703,7 +4714,19 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
private final void addJoin0(TableLike<?> table, JoinType type, Object conditions, Field<?>[] partitionBy) {
private final void addJoin0(TableLike<?> table, JoinType type, JoinHint hint, Object conditions, Field<?>[] partitionBy) {
// TODO: This and similar methods should be refactored, patterns extracted...
int index = getFrom().size() - 1;
@ -4715,7 +4738,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
case LEFT_SEMI_JOIN:
case LEFT_ANTI_JOIN:
case FULL_OUTER_JOIN: {
TableOptionalOnStep<Record> o = getFrom().get(index).join(table, type);
TableOptionalOnStep<Record> o = getFrom().get(index).join(table, type, hint);
if (conditions instanceof Condition c)
joined = o.on(c);
@ -4727,7 +4750,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
case LEFT_OUTER_JOIN:
case RIGHT_OUTER_JOIN: {
TablePartitionByStep<?> p = (TablePartitionByStep<?>) getFrom().get(index).join(table, type);
TablePartitionByStep<?> p = (TablePartitionByStep<?>) getFrom().get(index).join(table, type, hint);
TableOnStep<?> o = p;
@ -4749,7 +4772,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
case NATURAL_FULL_OUTER_JOIN:
case CROSS_APPLY:
case OUTER_APPLY:
joined = getFrom().get(index).join(table, type);
joined = getFrom().get(index).join(table, type, hint);
break;
default: throw new IllegalArgumentException("Bad join type: " + type);
@ -4760,6 +4783,12 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
@Override
public final void addJoinOnKey(TableLike<?> table, JoinType type) throws DataAccessException {
addJoinOnKey(table, type, (JoinHint) null);
}
@Override
public final void addJoinOnKey(TableLike<?> table, JoinType type, JoinHint hint) throws DataAccessException {
// TODO: This and similar methods should be refactored, patterns extracted...
int index = getFrom().size() - 1;
@ -4772,7 +4801,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
case FULL_OUTER_JOIN:
case LEFT_SEMI_JOIN:
case LEFT_ANTI_JOIN:
joined = getFrom().get(index).join(table, type).onKey();
joined = getFrom().get(index).join(table, type, hint).onKey();
break;
default:
@ -4784,6 +4813,12 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
@Override
public final void addJoinOnKey(TableLike<?> table, JoinType type, TableField<?, ?>... keyFields) throws DataAccessException {
addJoinOnKey(table, type, null, keyFields);
}
@Override
public final void addJoinOnKey(TableLike<?> table, JoinType type, JoinHint hint, TableField<?, ?>... keyFields) throws DataAccessException {
// TODO: This and similar methods should be refactored, patterns extracted...
int index = getFrom().size() - 1;
@ -4796,7 +4831,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
case FULL_OUTER_JOIN:
case LEFT_SEMI_JOIN:
case LEFT_ANTI_JOIN:
joined = getFrom().get(index).join(table, type).onKey(keyFields);
joined = getFrom().get(index).join(table, type, hint).onKey(keyFields);
break;
default:
@ -4808,6 +4843,11 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
@Override
public final void addJoinOnKey(TableLike<?> table, JoinType type, ForeignKey<?, ?> key) {
addJoinOnKey(table, type, null, key);
}
@Override
public final void addJoinOnKey(TableLike<?> table, JoinType type, JoinHint hint, ForeignKey<?, ?> key) {
// TODO: This and similar methods should be refactored, patterns extracted...
int index = getFrom().size() - 1;
@ -4820,7 +4860,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
case FULL_OUTER_JOIN:
case LEFT_SEMI_JOIN:
case LEFT_ANTI_JOIN:
joined = getFrom().get(index).join(table, type).onKey(key);
joined = getFrom().get(index).join(table, type, hint).onKey(key);
break;
default:
@ -4837,6 +4877,11 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
@Override
public final void addJoinUsing(TableLike<?> table, JoinType type, Collection<? extends Field<?>> fields) {
addJoinUsing(table, type, null, fields);
}
@Override
public final void addJoinUsing(TableLike<?> table, JoinType type, JoinHint hint, Collection<? extends Field<?>> fields) {
// TODO: This and similar methods should be refactored, patterns extracted...
int index = getFrom().size() - 1;
@ -4849,7 +4894,7 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
case FULL_OUTER_JOIN:
case LEFT_SEMI_JOIN:
case LEFT_ANTI_JOIN:
joined = getFrom().get(index).join(table, type).using(fields);
joined = getFrom().get(index).join(table, type, hint).using(fields);
break;
default: