diff --git a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java index 4da3470184..8c847efbdd 100644 --- a/jOOQ/src/main/java/org/jooq/SelectJoinStep.java +++ b/jOOQ/src/main/java/org/jooq/SelectJoinStep.java @@ -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 extends SelectWhereStep { @Support SelectOptionalOnStep join(TableLike table, JoinType type); + /** + * Convenience method to join a table to the last table added to the + * FROM clause using {@link Table#join(TableLike, JoinType, JoinHint)} + *

+ * Depending on the JoinType, 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 join(TableLike table, JoinType type, JoinHint hint); + /** * Convenience method to INNER JOIN a table to the last table * added to the FROM clause using {@link Table#join(TableLike)}. @@ -166,6 +180,45 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOnStep join(TableLike table); + /** + * Convenience method to INNER JOIN a table to the last table + * added to the FROM clause using {@link Table#hashJoin(TableLike)}. + *

+ * A synonym for {@link #innerHashJoin(TableLike)}. + * + * @see Table#hashJoin(TableLike) + * @see #innerHashJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectOnStep hashJoin(TableLike table); + + /** + * Convenience method to INNER JOIN a table to the last table + * added to the FROM clause using {@link Table#loopJoin(TableLike)}. + *

+ * A synonym for {@link #innerLoopJoin(TableLike)}. + * + * @see Table#loopJoin(TableLike) + * @see #innerLoopJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectOnStep loopJoin(TableLike table); + + /** + * Convenience method to INNER JOIN a table to the last table + * added to the FROM clause using {@link Table#mergeJoin(TableLike)}. + *

+ * A synonym for {@link #innerMergeJoin(TableLike)}. + * + * @see Table#mergeJoin(TableLike) + * @see #innerMergeJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectOnStep mergeJoin(TableLike table); + /** * Convenience method to INNER JOIN a path to the last table * added to the FROM clause using {@link Table#join(Path)}. @@ -179,6 +232,45 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOptionalOnStep join(Path path); + /** + * Convenience method to INNER JOIN a path to the last table + * added to the FROM clause using {@link Table#hashJoin(Path)}. + *

+ * A synonym for {@link #innerHashJoin(Path)}. + * + * @see Table#hashJoin(Path) + * @see #innerHashJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep hashJoin(Path path); + + /** + * Convenience method to INNER JOIN a path to the last table + * added to the FROM clause using {@link Table#loopJoin(Path)}. + *

+ * A synonym for {@link #innerLoopJoin(Path)}. + * + * @see Table#loopJoin(Path) + * @see #innerLoopJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep loopJoin(Path path); + + /** + * Convenience method to INNER JOIN a path to the last table + * added to the FROM clause using {@link Table#mergeJoin(Path)}. + *

+ * A synonym for {@link #innerMergeJoin(Path)}. + * + * @see Table#mergeJoin(Path) + * @see #innerMergeJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep mergeJoin(Path path); + /** * Convenience method to INNER JOIN a table to the last table * added to the FROM clause using {@link Table#join(String)}. @@ -293,6 +385,36 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOnStep innerJoin(TableLike table); + /** + * Convenience method to INNER JOIN a table to the last table + * added to the FROM clause using {@link Table#innerHashJoin(TableLike)}. + * + * @see Table#innerHashJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectOnStep innerHashJoin(TableLike table); + + /** + * Convenience method to INNER JOIN a table to the last table + * added to the FROM clause using {@link Table#innerLoopJoin(TableLike)}. + * + * @see Table#innerLoopJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectOnStep innerLoopJoin(TableLike table); + + /** + * Convenience method to INNER JOIN a table to the last table + * added to the FROM clause using {@link Table#innerMergeJoin(TableLike)}. + * + * @see Table#innerMergeJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectOnStep innerMergeJoin(TableLike table); + /** * Convenience method to INNER JOIN a path to the last table * added to the FROM clause using {@link Table#join(Path)}. @@ -303,6 +425,36 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOptionalOnStep innerJoin(Path path); + /** + * Convenience method to INNER JOIN a path to the last table + * added to the FROM clause using {@link Table#innerHashJoin(Path)}. + * + * @see Table#innerHashJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep innerHashJoin(Path path); + + /** + * Convenience method to INNER JOIN a path to the last table + * added to the FROM clause using {@link Table#innerLoopJoin(Path)}. + * + * @see Table#innerLoopJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep innerLoopJoin(Path path); + + /** + * Convenience method to INNER JOIN a path to the last table + * added to the FROM clause using {@link Table#innerMergeJoin(Path)}. + * + * @see Table#innerMergeJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep innerMergeJoin(Path path); + /** * Convenience method to INNER JOIN a table to the last table * added to the FROM clause using {@link Table#join(String)}. @@ -548,6 +700,48 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectJoinPartitionByStep leftJoin(TableLike table); + /** + * Convenience method to LEFT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#leftOuterHashJoin(TableLike)}. + *

+ * A synonym for {@link #leftOuterHashJoin(TableLike)}. + * + * @see Table#leftOuterHashJoin(TableLike) + * @see #leftOuterHashJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep leftHashJoin(TableLike table); + + /** + * Convenience method to LEFT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#leftOuterLoopJoin(TableLike)}. + *

+ * A synonym for {@link #leftOuterLoopJoin(TableLike)}. + * + * @see Table#leftOuterLoopJoin(TableLike) + * @see #leftOuterLoopJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep leftLoopJoin(TableLike table); + + /** + * Convenience method to LEFT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#leftOuterMergeJoin(TableLike)}. + *

+ * A synonym for {@link #leftOuterMergeJoin(TableLike)}. + * + * @see Table#leftOuterMergeJoin(TableLike) + * @see #leftOuterMergeJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep leftMergeJoin(TableLike table); + /** * Convenience method to LEFT OUTER JOIN a path to the last * table added to the FROM clause using @@ -562,6 +756,48 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOptionalOnStep leftJoin(Path table); + /** + * Convenience method to LEFT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#leftOuterHashJoin(Path)}. + *

+ * A synonym for {@link #leftOuterHashJoin(Path)}. + * + * @see Table#leftOuterHashJoin(Path) + * @see #leftOuterHashJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftHashJoin(Path table); + + /** + * Convenience method to LEFT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#leftOuterLoopJoin(Path)}. + *

+ * A synonym for {@link #leftOuterLoopJoin(Path)}. + * + * @see Table#leftOuterLoopJoin(Path) + * @see #leftOuterLoopJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftLoopJoin(Path table); + + /** + * Convenience method to LEFT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#leftOuterMergeJoin(Path)}. + *

+ * A synonym for {@link #leftOuterMergeJoin(Path)}. + * + * @see Table#leftOuterMergeJoin(Path) + * @see #leftOuterMergeJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftMergeJoin(Path table); + /** * Convenience method to LEFT OUTER JOIN a table to the last * table added to the FROM clause using @@ -678,6 +914,39 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectJoinPartitionByStep leftOuterJoin(TableLike table); + /** + * Convenience method to LEFT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#leftOuterHashJoin(TableLike)} + * + * @see Table#leftOuterHashJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep leftOuterHashJoin(TableLike table); + + /** + * Convenience method to LEFT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#leftOuterLoopJoin(TableLike)} + * + * @see Table#leftOuterLoopJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep leftOuterLoopJoin(TableLike table); + + /** + * Convenience method to LEFT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#leftOuterMergeJoin(TableLike)} + * + * @see Table#leftOuterMergeJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep leftOuterMergeJoin(TableLike table); + /** * Convenience method to LEFT OUTER JOIN a path to the last * table added to the FROM clause using @@ -689,6 +958,39 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOptionalOnStep leftOuterJoin(Path path); + /** + * Convenience method to LEFT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#leftOuterHashJoin(Path)} + * + * @see Table#leftOuterHashJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftOuterHashJoin(Path path); + + /** + * Convenience method to LEFT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#leftOuterLoopJoin(Path)} + * + * @see Table#leftOuterLoopJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftOuterLoopJoin(Path path); + + /** + * Convenience method to LEFT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#leftOuterMergeJoin(Path)} + * + * @see Table#leftOuterMergeJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep leftOuterMergeJoin(Path path); + /** * Convenience method to LEFT OUTER JOIN a table to the last * table added to the FROM clause using @@ -793,6 +1095,48 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectJoinPartitionByStep rightJoin(TableLike table); + /** + * Convenience method to RIGHT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#rightOuterHashJoin(TableLike)}. + *

+ * A synonym for {@link #rightOuterHashJoin(TableLike)}. + * + * @see Table#rightOuterHashJoin(TableLike) + * @see #rightOuterHashJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep rightHashJoin(TableLike table); + + /** + * Convenience method to RIGHT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#rightOuterLoopJoin(TableLike)}. + *

+ * A synonym for {@link #rightOuterLoopJoin(TableLike)}. + * + * @see Table#rightOuterLoopJoin(TableLike) + * @see #rightOuterLoopJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep rightLoopJoin(TableLike table); + + /** + * Convenience method to RIGHT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#rightOuterMergeJoin(TableLike)}. + *

+ * A synonym for {@link #rightOuterMergeJoin(TableLike)}. + * + * @see Table#rightOuterMergeJoin(TableLike) + * @see #rightOuterMergeJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep rightMergeJoin(TableLike table); + /** * Convenience method to RIGHT OUTER JOIN a path to the last * table added to the FROM clause using @@ -807,6 +1151,48 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOptionalOnStep rightJoin(Path path); + /** + * Convenience method to RIGHT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#rightOuterHashJoin(Path)}. + *

+ * A synonym for {@link #rightOuterHashJoin(Path)}. + * + * @see Table#rightOuterHashJoin(Path) + * @see #rightOuterHashJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep rightHashJoin(Path path); + + /** + * Convenience method to RIGHT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#rightOuterLoopJoin(Path)}. + *

+ * A synonym for {@link #rightOuterLoopJoin(Path)}. + * + * @see Table#rightOuterLoopJoin(Path) + * @see #rightOuterLoopJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep rightLoopJoin(Path path); + + /** + * Convenience method to RIGHT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#rightOuterMergeJoin(Path)}. + *

+ * A synonym for {@link #rightOuterMergeJoin(Path)}. + * + * @see Table#rightOuterMergeJoin(Path) + * @see #rightOuterMergeJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep rightMergeJoin(Path path); + /** * Convenience method to RIGHT OUTER JOIN a table to the last * table added to the FROM clause using @@ -923,6 +1309,39 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectJoinPartitionByStep rightOuterJoin(TableLike table); + /** + * Convenience method to RIGHT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#rightOuterHashJoin(TableLike)} + * + * @see Table#rightOuterHashJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep rightOuterHashJoin(TableLike table); + + /** + * Convenience method to RIGHT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#rightOuterLoopJoin(TableLike)} + * + * @see Table#rightOuterLoopJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep rightOuterLoopJoin(TableLike table); + + /** + * Convenience method to RIGHT OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#rightOuterMergeJoin(TableLike)} + * + * @see Table#rightOuterMergeJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support + SelectJoinPartitionByStep rightOuterMergeJoin(TableLike table); + /** * Convenience method to RIGHT OUTER JOIN a path to the last * table added to the FROM clause using @@ -934,6 +1353,39 @@ public interface SelectJoinStep extends SelectWhereStep { @Support SelectOptionalOnStep rightOuterJoin(Path path); + /** + * Convenience method to RIGHT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#rightOuterHashJoin(Path)} + * + * @see Table#rightOuterHashJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep rightOuterHashJoin(Path path); + + /** + * Convenience method to RIGHT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#rightOuterLoopJoin(Path)} + * + * @see Table#rightOuterLoopJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep rightOuterLoopJoin(Path path); + + /** + * Convenience method to RIGHT OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#rightOuterMergeJoin(Path)} + * + * @see Table#rightOuterMergeJoin(Path) + */ + @NotNull @CheckReturnValue + @Support + SelectOptionalOnStep rightOuterMergeJoin(Path path); + /** * Convenience method to RIGHT OUTER JOIN a table to the last * table added to the FROM clause using @@ -1035,6 +1487,39 @@ public interface SelectJoinStep extends SelectWhereStep { @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) SelectOnStep fullJoin(TableLike table); + /** + * Convenience method to FULL OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#fullOuterHashJoin(TableLike)}. + *

+ * A synonym for {@link #fullOuterHashJoin(TableLike)}. + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOnStep fullHashJoin(TableLike table); + + /** + * Convenience method to FULL OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#fullOuterLoopJoin(TableLike)}. + *

+ * A synonym for {@link #fullOuterLoopJoin(TableLike)}. + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOnStep fullLoopJoin(TableLike table); + + /** + * Convenience method to FULL OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#fullOuterMergeJoin(TableLike)}. + *

+ * A synonym for {@link #fullOuterMergeJoin(TableLike)}. + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOnStep fullMergeJoin(TableLike table); + /** * Convenience method to FULL OUTER JOIN a path to the last * table added to the FROM clause using @@ -1046,6 +1531,39 @@ public interface SelectJoinStep extends SelectWhereStep { @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) SelectOptionalOnStep fullJoin(Path table); + /** + * Convenience method to FULL OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#fullOuterHashJoin(Path)}. + *

+ * A synonym for {@link #fullOuterHashJoin(Path)}. + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOptionalOnStep fullHashJoin(Path table); + + /** + * Convenience method to FULL OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#fullOuterLoopJoin(Path)}. + *

+ * A synonym for {@link #fullOuterLoopJoin(Path)}. + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOptionalOnStep fullLoopJoin(Path table); + + /** + * Convenience method to FULL OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#fullOuterMergeJoin(Path)}. + *

+ * A synonym for {@link #fullOuterMergeJoin(Path)}. + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOptionalOnStep fullMergeJoin(Path table); + /** * Convenience method to FULL OUTER JOIN a table to the last * table added to the FROM clause using @@ -1136,6 +1654,39 @@ public interface SelectJoinStep extends SelectWhereStep { @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) SelectOnStep fullOuterJoin(TableLike table); + /** + * Convenience method to FULL OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#fullOuterHashJoin(TableLike)} + * + * @see Table#fullOuterHashJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOnStep fullOuterHashJoin(TableLike table); + + /** + * Convenience method to FULL OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#fullOuterLoopJoin(TableLike)} + * + * @see Table#fullOuterLoopJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOnStep fullOuterLoopJoin(TableLike table); + + /** + * Convenience method to FULL OUTER JOIN a table to the last + * table added to the FROM clause using + * {@link Table#fullOuterMergeJoin(TableLike)} + * + * @see Table#fullOuterMergeJoin(TableLike) + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOnStep fullOuterMergeJoin(TableLike table); + /** * Convenience method to FULL OUTER JOIN a path to the last * table added to the FROM clause using @@ -1147,6 +1698,39 @@ public interface SelectJoinStep extends SelectWhereStep { @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) SelectOptionalOnStep fullOuterJoin(Path table); + /** + * Convenience method to FULL OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#fullOuterHashJoin(Path)} + * + * @see Table#fullOuterHashJoin(Path) + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOptionalOnStep fullOuterHashJoin(Path table); + + /** + * Convenience method to FULL OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#fullOuterLoopJoin(Path)} + * + * @see Table#fullOuterLoopJoin(Path) + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOptionalOnStep fullOuterLoopJoin(Path table); + + /** + * Convenience method to FULL OUTER JOIN a path to the last + * table added to the FROM clause using + * {@link Table#fullOuterMergeJoin(Path)} + * + * @see Table#fullOuterMergeJoin(Path) + */ + @NotNull @CheckReturnValue + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + SelectOptionalOnStep fullOuterMergeJoin(Path table); + /** * Convenience method to FULL OUTER JOIN a table to the last * table added to the FROM clause using diff --git a/jOOQ/src/main/java/org/jooq/SelectQuery.java b/jOOQ/src/main/java/org/jooq/SelectQuery.java index 447eba06ba..8dbfd622e5 100644 --- a/jOOQ/src/main/java/org/jooq/SelectQuery.java +++ b/jOOQ/src/main/java/org/jooq/SelectQuery.java @@ -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 extends Select, 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 extends Select, ConditionProvi @Support void addJoinUsing(TableLike table, JoinType type, Collection> fields); + /** + * Joins the existing table product to a new table with a USING + * clause. + *

+ * 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 USING clause + */ + @Support + void addJoinUsing(TableLike table, JoinType type, JoinHint hint, Collection> fields); + /** * Joins the existing table product to a new table using a foreign key. * @@ -319,6 +395,39 @@ public interface SelectQuery extends Select, 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. Please note that if you evolve your + * schema, a previously non-ambiguous ON KEY clause + * can suddenly become ambiguous on an existing query, so use + * this clause with care. + */ + @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. Please note that if you evolve your + * schema, a previously non-ambiguous ON KEY clause + * can suddenly become ambiguous on an existing query, so use + * this clause with care. + */ + @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 extends Select, 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. *

diff --git a/jOOQ/src/main/java/org/jooq/Table.java b/jOOQ/src/main/java/org/jooq/Table.java index 31e52aa6fa..eb15659031 100644 --- a/jOOQ/src/main/java/org/jooq/Table.java +++ b/jOOQ/src/main/java/org/jooq/Table.java @@ -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. *

@@ -1045,6 +1047,42 @@ extends @Support TableOnStep join(TableLike table); + /** + * INNER JOIN a table to this table with a + * {@link JoinHint#HASH} hint. + *

+ * A synonym for {@link #innerHashJoin(TableLike)}. + * + * @see #innerHashJoin(TableLike) + */ + @NotNull + @Support + TableOnStep hashJoin(TableLike table); + + /** + * INNER JOIN a table to this table with a + * {@link JoinHint#LOOP} hint. + *

+ * A synonym for {@link #innerLoopJoin(TableLike)}. + * + * @see #innerLoopJoin(TableLike) + */ + @NotNull + @Support + TableOnStep loopJoin(TableLike table); + + /** + * INNER JOIN a table to this table with a + * {@link JoinHint#MERGE} hint. + *

+ * A synonym for {@link #innerMergeJoin(TableLike)}. + * + * @see #innerMergeJoin(TableLike) + */ + @NotNull + @Support + TableOnStep mergeJoin(TableLike table); + /** * INNER JOIN a path to this table. *

@@ -1054,6 +1092,36 @@ extends @Support TableOptionalOnStep join(Path path); + /** + * INNER JOIN a path to this table with a + * {@link JoinHint#HASH} hint. + *

+ * A synonym for {@link #innerHashJoin(Path)}. + */ + @NotNull + @Support + TableOptionalOnStep hashJoin(Path path); + + /** + * INNER JOIN a path to this table with a + * {@link JoinHint#LOOP} hint. + *

+ * A synonym for {@link #innerLoopJoin(Path)}. + */ + @NotNull + @Support + TableOptionalOnStep loopJoin(Path path); + + /** + * INNER JOIN a path to this table with a + * {@link JoinHint#MERGE} hint. + *

+ * A synonym for {@link #innerMergeJoin(Path)}. + */ + @NotNull + @Support + TableOptionalOnStep mergeJoin(Path path); + /** * INNER JOIN a table to this table. *

@@ -1152,6 +1220,30 @@ extends @Support TableOnStep innerJoin(TableLike table); + /** + * INNER JOIN a table to this table with a + * {@link JoinHint#HASH} hint. + */ + @NotNull + @Support + TableOnStep innerHashJoin(TableLike table); + + /** + * INNER JOIN a table to this table with a + * {@link JoinHint#LOOP} hint. + */ + @NotNull + @Support + TableOnStep innerLoopJoin(TableLike table); + + /** + * INNER JOIN a table to this table with a + * {@link JoinHint#MERGE} hint. + */ + @NotNull + @Support + TableOnStep innerMergeJoin(TableLike table); + /** * INNER JOIN a path to this table. */ @@ -1159,6 +1251,30 @@ extends @Support TableOptionalOnStep innerJoin(Path path); + /** + * INNER JOIN a path to this table with a + * {@link JoinHint#HASH} hint. + */ + @NotNull + @Support + TableOptionalOnStep innerHashJoin(Path path); + + /** + * INNER JOIN a path to this table with a + * {@link JoinHint#LOOP} hint. + */ + @NotNull + @Support + TableOptionalOnStep innerLoopJoin(Path path); + + /** + * INNER JOIN a path to this table with a + * {@link JoinHint#MERGE} hint. + */ + @NotNull + @Support + TableOptionalOnStep innerMergeJoin(Path path); + /** * INNER JOIN a table to this table. *

@@ -1265,6 +1381,42 @@ extends @Support TablePartitionByStep leftJoin(TableLike table); + /** + * LEFT OUTER JOIN a table to this table with a + * {@link JoinHint#HASH} hint. + *

+ * A synonym for {@link #leftOuterHashJoin(TableLike)}. + * + * @see #leftOuterHashJoin(TableLike) + */ + @NotNull + @Support + TablePartitionByStep leftHashJoin(TableLike table); + + /** + * LEFT OUTER JOIN a table to this table with a + * {@link JoinHint#LOOP} hint. + *

+ * A synonym for {@link #leftOuterLoopJoin(TableLike)}. + * + * @see #leftOuterLoopJoin(TableLike) + */ + @NotNull + @Support + TablePartitionByStep leftLoopJoin(TableLike table); + + /** + * LEFT OUTER JOIN a table to this table with a + * {@link JoinHint#MERGE} hint. + *

+ * A synonym for {@link #leftOuterMergeJoin(TableLike)}. + * + * @see #leftOuterMergeJoin(TableLike) + */ + @NotNull + @Support + TablePartitionByStep leftMergeJoin(TableLike table); + /** * LEFT OUTER JOIN a path to this table. *

@@ -1276,6 +1428,42 @@ extends @Support TableOptionalOnStep leftJoin(Path path); + /** + * LEFT OUTER JOIN a path to this table with a + * {@link JoinHint#HASH} hint. + *

+ * A synonym for {@link #leftOuterHashJoin(Path)}. + * + * @see #leftOuterHashJoin(Path) + */ + @NotNull + @Support + TableOptionalOnStep leftHashJoin(Path path); + + /** + * LEFT OUTER JOIN a path to this table with a + * {@link JoinHint#LOOP} hint. + *

+ * A synonym for {@link #leftOuterLoopJoin(Path)}. + * + * @see #leftOuterLoopJoin(Path) + */ + @NotNull + @Support + TableOptionalOnStep leftLoopJoin(Path path); + + /** + * LEFT OUTER JOIN a path to this table with a + * {@link JoinHint#MERGE} hint. + *

+ * A synonym for {@link #leftOuterMergeJoin(Path)}. + * + * @see #leftOuterMergeJoin(Path) + */ + @NotNull + @Support + TableOptionalOnStep leftMergeJoin(Path path); + /** * LEFT OUTER JOIN a table to this table. *

@@ -1373,6 +1561,30 @@ extends @Support TablePartitionByStep leftOuterJoin(TableLike table); + /** + * LEFT OUTER JOIN a table to this table with a + * {@link JoinHint#HASH} hint. + */ + @NotNull + @Support + TablePartitionByStep leftOuterHashJoin(TableLike table); + + /** + * LEFT OUTER JOIN a table to this table with a + * {@link JoinHint#LOOP} hint. + */ + @NotNull + @Support + TablePartitionByStep leftOuterLoopJoin(TableLike table); + + /** + * LEFT OUTER JOIN a table to this table with a + * {@link JoinHint#MERGE} hint. + */ + @NotNull + @Support + TablePartitionByStep leftOuterMergeJoin(TableLike table); + /** * LEFT OUTER JOIN a path to this table. */ @@ -1380,6 +1592,30 @@ extends @Support TableOptionalOnStep leftOuterJoin(Path path); + /** + * LEFT OUTER JOIN a path to this table with a + * {@link JoinHint#HASH} hint. + */ + @NotNull + @Support + TableOptionalOnStep leftOuterHashJoin(Path path); + + /** + * LEFT OUTER JOIN a path to this table with a + * {@link JoinHint#LOOP} hint. + */ + @NotNull + @Support + TableOptionalOnStep leftOuterLoopJoin(Path path); + + /** + * LEFT OUTER JOIN a path to this table with a + * {@link JoinHint#MERGE} hint. + */ + @NotNull + @Support + TableOptionalOnStep leftOuterMergeJoin(Path path); + /** * LEFT OUTER JOIN a table to this table. *

@@ -1467,6 +1703,42 @@ extends @Support TablePartitionByStep rightJoin(TableLike table); + /** + * RIGHT OUTER JOIN a table to this table with a + * {@link JoinHint#HASH} hint. + *

+ * A synonym for {@link #rightOuterHashJoin(TableLike)}. + * + * @see #rightOuterHashJoin(TableLike) + */ + @NotNull + @Support + TablePartitionByStep rightHashJoin(TableLike table); + + /** + * RIGHT OUTER JOIN a table to this table with a + * {@link JoinHint#LOOP} hint. + *

+ * A synonym for {@link #rightOuterLoopJoin(TableLike)}. + * + * @see #rightOuterLoopJoin(TableLike) + */ + @NotNull + @Support + TablePartitionByStep rightLoopJoin(TableLike table); + + /** + * RIGHT OUTER JOIN a table to this table with a + * {@link JoinHint#MERGE} hint. + *

+ * A synonym for {@link #rightOuterMergeJoin(TableLike)}. + * + * @see #rightOuterMergeJoin(TableLike) + */ + @NotNull + @Support + TablePartitionByStep rightMergeJoin(TableLike table); + /** * RIGHT OUTER JOIN a path to this table. *

@@ -1478,6 +1750,42 @@ extends @Support TableOptionalOnStep rightJoin(Path path); + /** + * RIGHT OUTER JOIN a path to this table with a + * {@link JoinHint#HASH} hint. + *

+ * A synonym for {@link #rightOuterHashJoin(Path)}. + * + * @see #rightOuterHashJoin(Path) + */ + @NotNull + @Support + TableOptionalOnStep rightHashJoin(Path path); + + /** + * RIGHT OUTER JOIN a path to this table with a + * {@link JoinHint#LOOP} hint. + *

+ * A synonym for {@link #rightOuterLoopJoin(Path)}. + * + * @see #rightOuterLoopJoin(Path) + */ + @NotNull + @Support + TableOptionalOnStep rightLoopJoin(Path path); + + /** + * RIGHT OUTER JOIN a path to this table with a + * {@link JoinHint#MERGE} hint. + *

+ * A synonym for {@link #rightOuterMergeJoin(Path)}. + * + * @see #rightOuterMergeJoin(Path) + */ + @NotNull + @Support + TableOptionalOnStep rightMergeJoin(Path path); + /** * RIGHT OUTER JOIN a table to this table. *

@@ -1575,6 +1883,30 @@ extends @Support TablePartitionByStep rightOuterJoin(TableLike table); + /** + * RIGHT OUTER JOIN a table to this table with a + * {@link JoinHint#HASH} hint. + */ + @NotNull + @Support + TablePartitionByStep rightOuterHashJoin(TableLike table); + + /** + * RIGHT OUTER JOIN a table to this table with a + * {@link JoinHint#LOOP} hint. + */ + @NotNull + @Support + TablePartitionByStep rightOuterLoopJoin(TableLike table); + + /** + * RIGHT OUTER JOIN a table to this table with a + * {@link JoinHint#MERGE} hint. + */ + @NotNull + @Support + TablePartitionByStep rightOuterMergeJoin(TableLike table); + /** * RIGHT OUTER JOIN a path to this table. */ @@ -1582,6 +1914,30 @@ extends @Support TableOptionalOnStep rightOuterJoin(Path path); + /** + * RIGHT OUTER JOIN a path to this table with a + * {@link JoinHint#HASH} hint. + */ + @NotNull + @Support + TableOptionalOnStep rightOuterHashJoin(Path path); + + /** + * RIGHT OUTER JOIN a path to this table with a + * {@link JoinHint#LOOP} hint. + */ + @NotNull + @Support + TableOptionalOnStep rightOuterLoopJoin(Path path); + + /** + * RIGHT OUTER JOIN a path to this table with a + * {@link JoinHint#MERGE} hint. + */ + @NotNull + @Support + TableOptionalOnStep rightOuterMergeJoin(Path path); + /** * RIGHT OUTER JOIN a table to this table. *

@@ -1666,6 +2022,36 @@ extends @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) TablePartitionByStep fullJoin(TableLike table); + /** + * FULL OUTER JOIN a table to this table with a + * {@link JoinHint#HASH} hint. + *

+ * A synonym for {@link #fullOuterHashJoin(TableLike)}. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TablePartitionByStep fullHashJoin(TableLike table); + + /** + * FULL OUTER JOIN a table to this table with a + * {@link JoinHint#LOOP} hint. + *

+ * A synonym for {@link #fullOuterLoopJoin(TableLike)}. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TablePartitionByStep fullLoopJoin(TableLike table); + + /** + * FULL OUTER JOIN a table to this table with a + * {@link JoinHint#MERGE} hint. + *

+ * A synonym for {@link #fullOuterMergeJoin(TableLike)}. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TablePartitionByStep fullMergeJoin(TableLike table); + /** * FULL OUTER JOIN a path to this table. *

@@ -1675,6 +2061,36 @@ extends @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) TableOptionalOnStep fullJoin(Path path); + /** + * FULL OUTER JOIN a path to this table with a + * {@link JoinHint#HASH} hint. + *

+ * A synonym for {@link #fullOuterHashJoin(Path)}. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TableOptionalOnStep fullHashJoin(Path path); + + /** + * FULL OUTER JOIN a path to this table with a + * {@link JoinHint#LOOP} hint. + *

+ * A synonym for {@link #fullOuterLoopJoin(Path)}. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TableOptionalOnStep fullLoopJoin(Path path); + + /** + * FULL OUTER JOIN a path to this table with a + * {@link JoinHint#MERGE} hint. + *

+ * A synonym for {@link #fullOuterMergeJoin(Path)}. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TableOptionalOnStep fullMergeJoin(Path path); + /** * FULL OUTER JOIN a table to this table. *

@@ -1751,6 +2167,30 @@ extends @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) TablePartitionByStep fullOuterJoin(TableLike table); + /** + * FULL OUTER JOIN a table to this table with a + * {@link JoinHint#HASH} hint. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TablePartitionByStep fullOuterHashJoin(TableLike table); + + /** + * FULL OUTER JOIN a table to this table with a + * {@link JoinHint#LOOP} hint. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TablePartitionByStep fullOuterLoopJoin(TableLike table); + + /** + * FULL OUTER JOIN a table to this table with a + * {@link JoinHint#MERGE} hint. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TablePartitionByStep fullOuterMergeJoin(TableLike table); + /** * FULL OUTER JOIN a path to this table. */ @@ -1758,6 +2198,30 @@ extends @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) TableOptionalOnStep fullOuterJoin(Path path); + /** + * FULL OUTER JOIN a path to this table with a + * {@link JoinHint#HASH} hint. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TableOptionalOnStep fullOuterHashJoin(Path path); + + /** + * FULL OUTER JOIN a path to this table with a + * {@link JoinHint#LOOP} hint. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TableOptionalOnStep fullOuterLoopJoin(Path path); + + /** + * FULL OUTER JOIN a path to this table with a + * {@link JoinHint#MERGE} hint. + */ + @NotNull + @Support({ FIREBIRD, HSQLDB, POSTGRES, SQLITE, TRINO, YUGABYTEDB }) + TableOptionalOnStep fullOuterMergeJoin(Path path); + /** * FULL OUTER JOIN a table to this table. *

diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java index a23c5abb55..561026c397 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java @@ -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 hashJoin(TableLike table) { + return innerHashJoin(table); + } + + @Override + public final TableOnStep loopJoin(TableLike table) { + return innerLoopJoin(table); + } + + @Override + public final TableOnStep mergeJoin(TableLike table) { + return innerMergeJoin(table); + } + @Override public final TableOptionalOnStep join(Path path) { return innerJoin(path); } + @Override + public final TableOptionalOnStep hashJoin(Path path) { + return innerHashJoin(path); + } + + @Override + public final TableOptionalOnStep loopJoin(Path path) { + return innerLoopJoin(path); + } + + @Override + public final TableOptionalOnStep mergeJoin(Path path) { + return innerMergeJoin(path); + } + @Override public final TableOnStep join(SQL sql) { return innerJoin(sql); @@ -1451,11 +1484,41 @@ implements return join(table, JOIN); } + @Override + public final TableOnStep innerHashJoin(TableLike table) { + return join(table, JOIN, HASH); + } + + @Override + public final TableOnStep innerLoopJoin(TableLike table) { + return join(table, JOIN, LOOP); + } + + @Override + public final TableOnStep innerMergeJoin(TableLike table) { + return join(table, JOIN, MERGE); + } + @Override public final TableOptionalOnStep innerJoin(Path path) { return join(path, JOIN); } + @Override + public final TableOptionalOnStep innerHashJoin(Path path) { + return join(path, JOIN, HASH); + } + + @Override + public final TableOptionalOnStep innerLoopJoin(Path path) { + return join(path, JOIN, LOOP); + } + + @Override + public final TableOptionalOnStep innerMergeJoin(Path path) { + return join(path, JOIN, MERGE); + } + @Override public final TableOnStep innerJoin(SQL sql) { return innerJoin(table(sql)); @@ -1500,11 +1563,41 @@ implements return leftOuterJoin(table); } + @Override + public final TablePartitionByStep leftHashJoin(TableLike table) { + return leftOuterHashJoin(table); + } + + @Override + public final TablePartitionByStep leftLoopJoin(TableLike table) { + return leftOuterLoopJoin(table); + } + + @Override + public final TablePartitionByStep leftMergeJoin(TableLike table) { + return leftOuterMergeJoin(table); + } + @Override public final TableOptionalOnStep leftJoin(Path path) { return leftOuterJoin(path); } + @Override + public final TableOptionalOnStep leftHashJoin(Path path) { + return leftOuterHashJoin(path); + } + + @Override + public final TableOptionalOnStep leftLoopJoin(Path path) { + return leftOuterLoopJoin(path); + } + + @Override + public final TableOptionalOnStep leftMergeJoin(Path path) { + return leftOuterMergeJoin(path); + } + @Override public final TablePartitionByStep leftJoin(SQL sql) { return leftOuterJoin(sql); @@ -1536,11 +1629,44 @@ implements return (TablePartitionByStep) join(table, LEFT_OUTER_JOIN); } + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep leftOuterHashJoin(TableLike table) { + return (TablePartitionByStep) join(table, LEFT_OUTER_JOIN, HASH); + } + + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep leftOuterLoopJoin(TableLike table) { + return (TablePartitionByStep) join(table, LEFT_OUTER_JOIN, LOOP); + } + + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep leftOuterMergeJoin(TableLike table) { + return (TablePartitionByStep) join(table, LEFT_OUTER_JOIN, MERGE); + } + @Override public final TableOptionalOnStep leftOuterJoin(Path path) { return join(path, LEFT_OUTER_JOIN); } + @Override + public final TableOptionalOnStep leftOuterHashJoin(Path path) { + return join(path, LEFT_OUTER_JOIN, HASH); + } + + @Override + public final TableOptionalOnStep leftOuterLoopJoin(Path path) { + return join(path, LEFT_OUTER_JOIN, LOOP); + } + + @Override + public final TableOptionalOnStep leftOuterMergeJoin(Path path) { + return join(path, LEFT_OUTER_JOIN, MERGE); + } + @Override public final TablePartitionByStep leftOuterJoin(SQL sql) { return leftOuterJoin(table(sql)); @@ -1571,11 +1697,41 @@ implements return rightOuterJoin(table); } + @Override + public final TablePartitionByStep rightHashJoin(TableLike table) { + return rightOuterHashJoin(table); + } + + @Override + public final TablePartitionByStep rightLoopJoin(TableLike table) { + return rightOuterLoopJoin(table); + } + + @Override + public final TablePartitionByStep rightMergeJoin(TableLike table) { + return rightOuterMergeJoin(table); + } + @Override public final TableOptionalOnStep rightJoin(Path path) { return rightOuterJoin(path); } + @Override + public final TableOptionalOnStep rightHashJoin(Path path) { + return rightOuterHashJoin(path); + } + + @Override + public final TableOptionalOnStep rightLoopJoin(Path path) { + return rightOuterLoopJoin(path); + } + + @Override + public final TableOptionalOnStep rightMergeJoin(Path path) { + return rightOuterMergeJoin(path); + } + @Override public final TablePartitionByStep rightJoin(SQL sql) { return rightOuterJoin(sql); @@ -1607,11 +1763,44 @@ implements return (TablePartitionByStep) join(table, RIGHT_OUTER_JOIN); } + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep rightOuterHashJoin(TableLike table) { + return (TablePartitionByStep) join(table, RIGHT_OUTER_JOIN, HASH); + } + + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep rightOuterLoopJoin(TableLike table) { + return (TablePartitionByStep) join(table, RIGHT_OUTER_JOIN, LOOP); + } + + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep rightOuterMergeJoin(TableLike table) { + return (TablePartitionByStep) join(table, RIGHT_OUTER_JOIN, MERGE); + } + @Override public final TableOptionalOnStep rightOuterJoin(Path path) { return join(path, RIGHT_OUTER_JOIN); } + @Override + public final TableOptionalOnStep rightOuterHashJoin(Path path) { + return join(path, RIGHT_OUTER_JOIN, HASH); + } + + @Override + public final TableOptionalOnStep rightOuterLoopJoin(Path path) { + return join(path, RIGHT_OUTER_JOIN, LOOP); + } + + @Override + public final TableOptionalOnStep rightOuterMergeJoin(Path path) { + return join(path, RIGHT_OUTER_JOIN, MERGE); + } + @Override public final TablePartitionByStep rightOuterJoin(SQL sql) { return rightOuterJoin(table(sql)); @@ -1643,11 +1832,44 @@ implements return (TablePartitionByStep) join(table, FULL_OUTER_JOIN); } + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep fullOuterHashJoin(TableLike table) { + return (TablePartitionByStep) join(table, FULL_OUTER_JOIN, HASH); + } + + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep fullOuterLoopJoin(TableLike table) { + return (TablePartitionByStep) join(table, FULL_OUTER_JOIN, LOOP); + } + + @SuppressWarnings("unchecked") + @Override + public final TablePartitionByStep fullOuterMergeJoin(TableLike table) { + return (TablePartitionByStep) join(table, FULL_OUTER_JOIN, MERGE); + } + @Override public final TableOptionalOnStep fullOuterJoin(Path path) { return join(path, FULL_OUTER_JOIN); } + @Override + public final TableOptionalOnStep fullOuterHashJoin(Path path) { + return join(path, FULL_OUTER_JOIN, HASH); + } + + @Override + public final TableOptionalOnStep fullOuterLoopJoin(Path path) { + return join(path, FULL_OUTER_JOIN, LOOP); + } + + @Override + public final TableOptionalOnStep fullOuterMergeJoin(Path path) { + return join(path, FULL_OUTER_JOIN, MERGE); + } + @Override public final TablePartitionByStep fullOuterJoin(SQL sql) { return fullOuterJoin(table(sql)); @@ -1678,11 +1900,41 @@ implements return fullOuterJoin(table); } + @Override + public final TablePartitionByStep fullHashJoin(TableLike table) { + return fullOuterHashJoin(table); + } + + @Override + public final TablePartitionByStep fullLoopJoin(TableLike table) { + return fullOuterLoopJoin(table); + } + + @Override + public final TablePartitionByStep fullMergeJoin(TableLike table) { + return fullOuterMergeJoin(table); + } + @Override public final TableOptionalOnStep fullJoin(Path path) { return fullOuterJoin(path); } + @Override + public final TableOptionalOnStep fullHashJoin(Path path) { + return fullOuterHashJoin(path); + } + + @Override + public final TableOptionalOnStep fullLoopJoin(Path path) { + return fullOuterLoopJoin(path); + } + + @Override + public final TableOptionalOnStep fullMergeJoin(Path path) { + return fullOuterMergeJoin(path); + } + @Override public final TablePartitionByStep fullJoin(SQL sql) { return fullOuterJoin(sql); diff --git a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java index 036f13f384..5a34c6d080 100755 --- a/jOOQ/src/main/java/org/jooq/impl/JoinTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/JoinTable.java @@ -235,15 +235,15 @@ abstract class JoinTable> extends AbstractJoinTable { 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> extends AbstractJoinTable { + + + + else keyword = translatedType.toKeyword(); @@ -450,9 +454,44 @@ abstract class JoinTable> extends AbstractJoinTable { break; } + + + + return keyword; } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + private void toSQLTable(Context ctx, Table table) { // [#671] Some databases formally require nested JOINS on the right hand diff --git a/jOOQ/src/main/java/org/jooq/impl/KeywordImpl.java b/jOOQ/src/main/java/org/jooq/impl/KeywordImpl.java index ed93bfdb8f..4418ee0f65 100644 --- a/jOOQ/src/main/java/org/jooq/impl/KeywordImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/KeywordImpl.java @@ -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; /** diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java index 6bfb7bdc7c..ec337403c7 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectImpl.java @@ -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> 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; diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java index 8ad7095b0e..329d6abab6 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java @@ -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 extends AbstractResultQuery 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 extends AbstractResultQuery 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 extends AbstractResultQuery imp case LEFT_SEMI_JOIN: case LEFT_ANTI_JOIN: case FULL_OUTER_JOIN: { - TableOptionalOnStep o = getFrom().get(index).join(table, type); + TableOptionalOnStep o = getFrom().get(index).join(table, type, hint); if (conditions instanceof Condition c) joined = o.on(c); @@ -4727,7 +4750,7 @@ final class SelectQueryImpl extends AbstractResultQuery 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 extends AbstractResultQuery 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 extends AbstractResultQuery 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 extends AbstractResultQuery 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 extends AbstractResultQuery 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 extends AbstractResultQuery 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 extends AbstractResultQuery 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 extends AbstractResultQuery 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 extends AbstractResultQuery imp @Override public final void addJoinUsing(TableLike table, JoinType type, Collection> fields) { + addJoinUsing(table, type, null, fields); + } + + @Override + public final void addJoinUsing(TableLike table, JoinType type, JoinHint hint, Collection> fields) { // TODO: This and similar methods should be refactored, patterns extracted... int index = getFrom().size() - 1; @@ -4849,7 +4894,7 @@ final class SelectQueryImpl extends AbstractResultQuery 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: