-
- All Superinterfaces:
Attachable
,AutoCloseable
,ConditionProvider
,FieldLike
,Flow.Publisher<R>
,Iterable<R>
,org.reactivestreams.Publisher<R>
,Query
,QueryPart
,ResultQuery<R>
,Select<R>
,Serializable
,Statement
,TableLike<R>
public interface SelectQuery<R extends Record> extends Select<R>, ConditionProvider
ASELECT
statement (model API).This type is the model API representation of a
Select
statement, which can be mutated after creation. The advantage of this API compared to the DSL API is a more simple approach to writing dynamic SQL.Instances can be created using
DSLContext.selectQuery()
and overloads.- Author:
- Lukas Eder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addConditions(Collection<? extends Condition> conditions)
Adds new conditions to the query, connecting them to existing conditions withOperator.AND
.void
addConditions(Condition condition)
Adds a new condition to the query, connecting them to existing conditions withOperator.AND
.void
addConditions(Condition... conditions)
Adds new conditions to the query, connecting them to existing conditions withOperator.AND
.void
addConditions(Operator operator, Collection<? extends Condition> conditions)
Adds new conditions to the query, connecting them to existing conditions with the provided operator.void
addConditions(Operator operator, Condition condition)
Adds a new condition to the query, connecting them to existing conditions with the provided operator.void
addConditions(Operator operator, Condition... conditions)
Adds new conditions to the query, connecting them to existing conditions with the provided operator.void
addConnectBy(Condition condition)
Add an Oracle-specificCONNECT BY
clause to the query.void
addConnectByNoCycle(Condition condition)
Add an Oracle-specificCONNECT BY NOCYCLE
clause to the query.void
addDistinctOn(Collection<? extends SelectFieldOrAsterisk> fields)
Add a PostgreSQL-specificDISTINCT ON (fields...)
clause.void
addDistinctOn(SelectFieldOrAsterisk... fields)
Add a PostgreSQL-specificDISTINCT ON (fields...)
clause.void
addFrom(Collection<? extends TableLike<?>> from)
Add tables to the table product.void
addFrom(TableLike<?> from)
Add tables to the table product.void
addFrom(TableLike<?>... from)
Add tables to the table product.void
addGroupBy(Collection<? extends GroupField> fields)
Adds grouping fields.void
addGroupBy(GroupField... fields)
Adds grouping fields.void
addHaving(Collection<? extends Condition> conditions)
Adds new conditions to the having clause of the query, connecting them with each other withOperator.AND
.void
addHaving(Condition condition)
Adds a new condition to the having clause of the query, connecting it with each other withOperator.AND
.void
addHaving(Condition... conditions)
Adds new conditions to the having clause of the query, connecting them with each other withOperator.AND
.void
addHaving(Operator operator, Collection<? extends Condition> conditions)
Adds new conditions to the having clause of query, connecting them with each other withoperator
.void
addHaving(Operator operator, Condition condition)
Adds a new condition to the having clause of query, connecting it with each other withoperator
.void
addHaving(Operator operator, Condition... conditions)
Adds new conditions to the having clause of query, connecting them with each other withoperator
.void
addHint(String hint)
Add an Oracle-style hint to the select clause.void
addJoin(TableLike<?> table, Condition condition)
Joins the existing table product to a new table using a condition, connecting them with each other withOperator.AND
.void
addJoin(TableLike<?> table, Condition... conditions)
Joins the existing table product to a new table using a condition, connecting them with each other withOperator.AND
.void
addJoin(TableLike<?> table, JoinType type, Condition condition)
Joins the existing table product to a new table using a condition, connecting them with each other withOperator.AND
.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 withOperator.AND
.void
addJoin(TableLike<?> table, JoinType type, Condition[] conditions, Field<?>[] partitionBy)
Joins the existing table product to a new table using conditions, connecting them with each other withOperator.AND
.void
addJoin(TableLike<?> table, JoinType type, Condition conditions, Field<?>[] partitionBy)
Joins the existing table product to a new table using conditions, connecting them with each other withOperator.AND
.void
addJoinOnKey(TableLike<?> table, JoinType type)
Joins the existing table product to a new table using a foreign key.void
addJoinOnKey(TableLike<?> table, JoinType type, ForeignKey<?,?> key)
Joins the existing table product to a new table using a foreign key.void
addJoinOnKey(TableLike<?> table, JoinType type, TableField<?,?>... keyFields)
Joins the existing table product to a new table using a foreign key.void
addJoinUsing(TableLike<?> table, Collection<? extends Field<?>> fields)
Joins the existing table product to a new table with aUSING
clause.void
addJoinUsing(TableLike<?> table, JoinType type, Collection<? extends Field<?>> fields)
Joins the existing table product to a new table with aUSING
clause.void
addLimit(int numberOfRows)
Limit the results of this select.void
addLimit(int offset, int numberOfRows)
Limit the results of this select.void
addLimit(int offset, Param<Integer> numberOfRows)
Limit the results of this select using named parameters.void
addLimit(Number numberOfRows)
Limit the results of this select.void
addLimit(Number offset, Number numberOfRows)
Limit the results of this select.void
addLimit(Number offset, Param<? extends Number> numberOfRows)
Limit the results of this select using named parameters.void
addLimit(Param<? extends Number> numberOfRows)
Limit the results of this select using named parameters.void
addLimit(Param<? extends Number> offset, Number numberOfRows)
Limit the results of this select.void
addLimit(Param<? extends Number> offset, Param<? extends Number> numberOfRows)
Limit the results of this select using named parameters.void
addLimit(Param<Integer> offset, int numberOfRows)
Limit the results of this select.void
addOffset(int offset)
Add anOFFSET
clause to the query.void
addOffset(Number offset)
Add anOFFSET
clause to the query.void
addOffset(Param<? extends Number> offset)
Add anOFFSET
clause to the query using a named parameter.void
addOption(String option)
Add a SQL Server-style query hint to the select clause.void
addOrderBy(int... fieldIndexes)
Adds ordering fields.void
addOrderBy(Collection<? extends OrderField<?>> fields)
Adds ordering fields.void
addOrderBy(OrderField<?>... fields)
Adds ordering fields.void
addQualify(Collection<? extends Condition> conditions)
Adds new conditions to the qualify clause of the query, connecting them with each other withOperator.AND
.void
addQualify(Condition condition)
Adds a new condition to the qualify clause of the query, connecting it with each other withOperator.AND
.void
addQualify(Condition... conditions)
Adds new conditions to the qualify clause of the query, connecting them with each other withOperator.AND
.void
addQualify(Operator operator, Collection<? extends Condition> conditions)
Adds new conditions to the qualify clause of query, connecting them with each other withoperator
.void
addQualify(Operator operator, Condition condition)
Adds a new condition to the qualify clause of query, connecting it with each other withoperator
.void
addQualify(Operator operator, Condition... conditions)
Adds new conditions to the qualify clause of query, connecting them with each other withoperator
.void
addSeekAfter(Collection<? extends Field<?>> fields)
Adds seeking fields.void
addSeekAfter(Field<?>... fields)
Adds seeking fields.void
addSeekBefore(Collection<? extends Field<?>> fields)
Deprecated.- [#7461] - SEEK BEFORE is not implemented correctlyvoid
addSeekBefore(Field<?>... fields)
Deprecated.- [#7461] - SEEK BEFORE is not implemented correctlyvoid
addSelect(Collection<? extends SelectFieldOrAsterisk> fields)
Add a list of select fields.void
addSelect(SelectFieldOrAsterisk... fields)
Add a list of select fields.void
addWindow(Collection<? extends WindowDefinition> definitions)
Adds new window definitions to the window clause of the query.void
addWindow(WindowDefinition... definitions)
Adds new window definitions to the window clause of the query.void
setConnectByStartWith(Condition condition)
Add an Oracle-specificSTART WITH
clause to the query'sCONNECT BY
clause.void
setDistinct(boolean distinct)
Add "distinct" keyword to the select clause.void
setForJSONAuto(boolean forJSONAuto)
Add aFOR JSON AUTO
clause to the end of the query.void
setForJSONB(boolean forJSONB)
void
setForJSONIncludeNullValues(boolean forJSONIncludeNullValues)
Add aFOR JSON ROOT
clause to the end of the query.void
setForJSONPath(boolean forJSONPath)
Add aFOR JSON PATH
clause to the end of the query.void
setForJSONRoot(boolean forJSONRoot)
Add aFOR JSON ROOT
clause to the end of the query.void
setForJSONRoot(boolean forJSONRoot, String rootName)
Add aFOR JSON ROOT
clause to the end of the query.void
setForJSONWithoutArrayWrapper(boolean forJSONWithoutArrayWrapper)
Add aFOR JSON ROOT
clause to the end of the query.void
setForKeyShare(boolean forKeyShare)
Sets the "FOR KEY SHARE" lock mode onto the query.void
setForLockModeNoWait()
Some RDBMS allow for specifying the locking mode for the appliedFOR <lock_mode>
clause.void
setForLockModeOf(Collection<? extends Field<?>> fields)
Some RDBMS allow for specifying the fields that should be locked by theFOR <lock_mode>
clause, instead of the full row.void
setForLockModeOf(Field<?>... fields)
Some RDBMS allow for specifying the fields that should be locked by theFOR <lock_mode>
clause, instead of the full row.void
setForLockModeOf(Table<?>... tables)
Some RDBMS allow for specifying the tables that should be locked by theFOR <lock_mode>
clause, instead of the full row.void
setForLockModeSkipLocked()
Some RDBMS allow for specifying the locking mode for the appliedFOR <lock_mode>
clause.void
setForLockModeWait(int seconds)
Some RDBMS allow for specifying the locking mode for the appliedFOR <lock_mode>
clause.void
setForNoKeyUpdate(boolean forNoKeyUpdate)
Sets the "FOR NO KEY UPDATE" lock mode onto the query.void
setForShare(boolean forShare)
Sets the "FOR SHARE" lock mode onto the query.void
setForUpdate(boolean forUpdate)
Sets the "FOR UPDATE" lock mode onto the query.void
setForUpdateNoWait()
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeNoWait()
void
setForUpdateOf(Collection<? extends Field<?>> fields)
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeOf(Collection)
void
setForUpdateOf(Field<?>... fields)
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeOf(Field...)
void
setForUpdateOf(Table<?>... tables)
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeOf(Table...)
void
setForUpdateSkipLocked()
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeSkipLocked()
void
setForUpdateWait(int seconds)
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeWait(int)
void
setForXMLAuto(boolean forXMLAuto)
Add aFOR XML AUTO
clause to the end of the query.void
setForXMLElements(boolean forXMLElements)
Add aFOR XML ELEMENTS
clause to the end of the query.void
setForXMLPath(boolean forXMLPath)
Add aFOR XML PATH
clause to the end of the query.void
setForXMLPath(boolean forXMLPath, String elementName)
Add aFOR XML PATH
clause to the end of the query.void
setForXMLRaw(boolean forXMLRaw)
Add aFOR XML RAW
clause to the end of the query.void
setForXMLRaw(boolean forXMLRaw, String elementName)
Add aFOR XML RAW
clause to the end of the query.void
setForXMLRoot(boolean forXMLRoot)
Add aFOR XML ROOT
clause to the end of the query.void
setForXMLRoot(boolean forXMLRoot, String rootName)
Add aFOR XML ROOT
clause to the end of the query.void
setInto(Table<?> table)
AddINTO
clause to theSELECT
statement.void
setLimitPercent(boolean percent)
Add thePERCENT
clause to aLIMIT
clause.void
setOrderBySiblings(boolean orderBySiblings)
Indicate whether theSIBLINGS
keyword should be used in anORDER BY
clause to form anORDER SIBLINGS BY
clause.void
setWithCheckOption()
Add aWITH CHECK OPTION
clause to the end of the subquery.void
setWithReadOnly()
Add aWITH READ ONLY
clause to the end of the subquery.void
setWithTies(boolean withTies)
Add theWITH TIES
clause to aLIMIT
clause.-
Methods inherited from interface org.jooq.Attachable
attach, configuration, detach
-
Methods inherited from interface java.util.concurrent.Flow.Publisher
subscribe
-
Methods inherited from interface org.jooq.Query
cancel, close, execute, executeAsync, executeAsync, getBindValues, getParam, getParams, getSQL, getSQL, getSQL, isExecutable
-
Methods inherited from interface org.jooq.ResultQuery
bind, bind, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, coerce, collect, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetch, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAny, fetchAnyArray, fetchAnyInto, fetchAnyInto, fetchAnyMap, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArray, fetchArrays, fetchAsync, fetchAsync, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchGroups, fetchInto, fetchInto, fetchInto, fetchLater, fetchLater, fetchLazy, fetchLazy, fetchMany, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMap, fetchMaps, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOne, fetchOneArray, fetchOneInto, fetchOneInto, fetchOneMap, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptional, fetchOptionalArray, fetchOptionalInto, fetchOptionalInto, fetchOptionalMap, fetchResultSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSet, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingle, fetchSingleArray, fetchSingleInto, fetchSingleInto, fetchSingleMap, fetchSize, fetchStream, fetchStreamInto, fetchStreamInto, forEach, getRecordType, getResult, intern, intern, intern, intern, iterator, keepStatement, maxRows, poolable, queryTimeout, resultSetConcurrency, resultSetHoldability, resultSetType, spliterator, stream
-
Methods inherited from interface org.jooq.Select
except, exceptAll, fetchCount, getSelect, intersect, intersectAll, union, unionAll
-
-
-
-
Method Detail
-
addSelect
@Support void addSelect(SelectFieldOrAsterisk... fields)
Add a list of select fields.- Parameters:
fields
-
-
addSelect
@Support void addSelect(Collection<? extends SelectFieldOrAsterisk> fields)
Add a list of select fields.- Parameters:
fields
-
-
setDistinct
@Support void setDistinct(boolean distinct)
Add "distinct" keyword to the select clause.
-
addDistinctOn
@Support({AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,FIREBIRD_3_0,H2,HANA,INFORMIX,MARIADB,MEMSQL,MYSQL_8_0,ORACLE,POSTGRES,REDSHIFT,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addDistinctOn(SelectFieldOrAsterisk... fields)
Add a PostgreSQL-specificDISTINCT ON (fields...)
clause.This also sets the
distinct
flag totrue
-
addDistinctOn
@Support({AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,FIREBIRD_3_0,H2,HANA,INFORMIX,MARIADB,MEMSQL,MYSQL_8_0,ORACLE,POSTGRES,REDSHIFT,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addDistinctOn(Collection<? extends SelectFieldOrAsterisk> fields)
Add a PostgreSQL-specificDISTINCT ON (fields...)
clause.This also sets the
distinct
flag totrue
-
setInto
@Support({ACCESS,ASE,AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,TERADATA}) void setInto(Table<?> table)
AddINTO
clause to theSELECT
statement.
-
addFrom
@Support void addFrom(TableLike<?> from)
Add tables to the table product.- Parameters:
from
- The added tables
-
addFrom
@Support void addFrom(TableLike<?>... from)
Add tables to the table product.- Parameters:
from
- The added tables
-
addFrom
@Support void addFrom(Collection<? extends TableLike<?>> from)
Add tables to the table product.- Parameters:
from
- The added tables
-
addJoin
@Support void addJoin(TableLike<?> table, Condition condition)
Joins the existing table product to a new table using a condition, connecting them with each other withOperator.AND
.- Parameters:
table
- The joined tablecondition
- The joining condition
-
addJoin
@Support void addJoin(TableLike<?> table, Condition... conditions)
Joins the existing table product to a new table using a condition, connecting them with each other withOperator.AND
.- Parameters:
table
- The joined tableconditions
- The joining conditions
-
addJoin
@Support void addJoin(TableLike<?> table, JoinType type, Condition condition)
Joins the existing table product to a new table using a condition, connecting them with each other withOperator.AND
.- Parameters:
table
- The joined tabletype
- The type of joincondition
- The joining condition
-
addJoin
@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 withOperator.AND
.- Parameters:
table
- The joined tabletype
- The type of joinconditions
- The joining conditions
-
addJoin
@Support(ORACLE) @Pro void addJoin(TableLike<?> table, JoinType type, Condition conditions, Field<?>[] partitionBy)
Joins the existing table product to a new table using conditions, connecting them with each other withOperator.AND
.This adds a
PARTITION BY
clause to the right hand side of aOUTER JOIN
expression.- Parameters:
table
- The joined tabletype
- The type of joinconditions
- The joining conditionspartitionBy
- ThePARTITION BY
expression- See Also:
TablePartitionByStep
-
addJoin
@Support(ORACLE) @Pro void addJoin(TableLike<?> table, JoinType type, Condition[] conditions, Field<?>[] partitionBy)
Joins the existing table product to a new table using conditions, connecting them with each other withOperator.AND
.This adds a
PARTITION BY
clause to the right hand side of aOUTER JOIN
expression.- Parameters:
table
- The joined tabletype
- The type of joinconditions
- The joining conditionspartitionBy
- ThePARTITION BY
expression- See Also:
TablePartitionByStep
-
addJoinUsing
@Support void addJoinUsing(TableLike<?> table, Collection<? extends Field<?>> fields)
Joins the existing table product to a new table with aUSING
clause.If this is not supported by your RDBMS, then jOOQ will try to emulate this behaviour using the information provided in this query.
- Parameters:
table
- The joined tablefields
- The fields for theUSING
clause
-
addJoinUsing
@Support void addJoinUsing(TableLike<?> table, JoinType type, Collection<? extends Field<?>> fields)
Joins the existing table product to a new table with aUSING
clause.If this is not supported by your RDBMS, then jOOQ will try to emulate this behaviour using the information provided in this query.
- Parameters:
table
- The joined tabletype
- The type of joinfields
- The fields for theUSING
clause
-
addJoinOnKey
@Support void addJoinOnKey(TableLike<?> table, JoinType type) throws DataAccessException
Joins the existing table product to a new table using a foreign key.- Parameters:
table
- The joined tabletype
- The type of join- Throws:
DataAccessException
- If there is no non-ambiguous key definition known to jOOQ- See Also:
TableOnStep.onKey(ForeignKey)
-
addJoinOnKey
@Support void addJoinOnKey(TableLike<?> table, JoinType type, TableField<?,?>... keyFields) throws DataAccessException
Joins the existing table product to a new table using a foreign key.- Parameters:
table
- The joined tabletype
- The type of joinkeyFields
- The foreign key fields- Throws:
DataAccessException
- If there is no non-ambiguous key definition known to jOOQ- See Also:
TableOnStep.onKey(ForeignKey)
-
addJoinOnKey
@Support void addJoinOnKey(TableLike<?> table, JoinType type, ForeignKey<?,?> key)
Joins the existing table product to a new table using a foreign key.- Parameters:
table
- The joined tabletype
- The type of joinkey
- The foreign key- See Also:
TableOnStep.onKey(ForeignKey)
-
addGroupBy
@Support void addGroupBy(GroupField... fields)
Adds grouping fields.Calling this with an empty argument list will result in an empty
GROUP BY ()
clause being rendered.- Parameters:
fields
- The grouping fields
-
addGroupBy
@Support void addGroupBy(Collection<? extends GroupField> fields)
Adds grouping fields.Calling this with an empty argument list will result in an empty
GROUP BY ()
clause being rendered.- Parameters:
fields
- The grouping fields
-
addHaving
@Support void addHaving(Condition condition)
Adds a new condition to the having clause of the query, connecting it with each other withOperator.AND
.- Parameters:
condition
- The condition
-
addHaving
@Support void addHaving(Condition... conditions)
Adds new conditions to the having clause of the query, connecting them with each other withOperator.AND
.- Parameters:
conditions
- The condition
-
addHaving
@Support void addHaving(Collection<? extends Condition> conditions)
Adds new conditions to the having clause of the query, connecting them with each other withOperator.AND
.- Parameters:
conditions
- The condition
-
addHaving
@Support void addHaving(Operator operator, Condition condition)
Adds a new condition to the having clause of query, connecting it with each other withoperator
.- Parameters:
operator
- The operator to use to add the conditions to the existing conditionscondition
- The condition
-
addHaving
@Support void addHaving(Operator operator, Condition... conditions)
Adds new conditions to the having clause of query, connecting them with each other withoperator
.- Parameters:
operator
- The operator to use to add the conditions to the existing conditionsconditions
- The condition
-
addHaving
@Support void addHaving(Operator operator, Collection<? extends Condition> conditions)
Adds new conditions to the having clause of query, connecting them with each other withoperator
.- Parameters:
operator
- The operator to use to add the conditions to the existing conditionsconditions
- The condition
-
addWindow
@Support({AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,FIREBIRD_3_0,H2,HANA,INFORMIX,MARIADB,MEMSQL,MYSQL_8_0,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addWindow(WindowDefinition... definitions)
Adds new window definitions to the window clause of the query.- Parameters:
definitions
- The definitions
-
addWindow
@Support({AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,FIREBIRD_3_0,H2,HANA,INFORMIX,MARIADB,MEMSQL,MYSQL_8_0,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addWindow(Collection<? extends WindowDefinition> definitions)
Adds new window definitions to the window clause of the query.- Parameters:
definitions
- The definitions
-
addQualify
@Support({H2,TERADATA}) void addQualify(Condition condition)
Adds a new condition to the qualify clause of the query, connecting it with each other withOperator.AND
.- Parameters:
condition
- The condition
-
addQualify
@Support({H2,TERADATA}) void addQualify(Condition... conditions)
Adds new conditions to the qualify clause of the query, connecting them with each other withOperator.AND
.- Parameters:
conditions
- The condition
-
addQualify
@Support({H2,TERADATA}) void addQualify(Collection<? extends Condition> conditions)
Adds new conditions to the qualify clause of the query, connecting them with each other withOperator.AND
.- Parameters:
conditions
- The condition
-
addQualify
@Support({H2,TERADATA}) void addQualify(Operator operator, Condition condition)
Adds a new condition to the qualify clause of query, connecting it with each other withoperator
.- Parameters:
operator
- The operator to use to add the conditions to the existing conditionscondition
- The condition
-
addQualify
@Support({H2,TERADATA}) void addQualify(Operator operator, Condition... conditions)
Adds new conditions to the qualify clause of query, connecting them with each other withoperator
.- Parameters:
operator
- The operator to use to add the conditions to the existing conditionsconditions
- The condition
-
addQualify
@Support({H2,TERADATA}) void addQualify(Operator operator, Collection<? extends Condition> conditions)
Adds new conditions to the qualify clause of query, connecting them with each other withoperator
.- Parameters:
operator
- The operator to use to add the conditions to the existing conditionsconditions
- The condition
-
addHint
@Support void addHint(String hint)
Add an Oracle-style hint to the select clause.Example:
DSLContext create = DSL.using(configuration); create.select(field1, field2) .hint("/*+ALL_ROWS*/") .from(table1) .execute();
You can also use this clause for any other database, that accepts hints or options at the same syntactic location, e.g. for MySQL's
SQL_CALC_FOUND_ROWS
option:create.select(field1, field2) .hint("SQL_CALC_FOUND_ROWS") .from(table1) .fetch();
The outcome of such a query is this:
SELECT [hint] field1, field2 FROM table1
For SQL Server style table hints, see
Table.with(String)
- See Also:
Table.with(String)
-
addOption
@Support void addOption(String option)
Add a SQL Server-style query hint to the select clause.Example:
DSLContext create = DSL.using(configuration); create.select(field1, field2) .from(table1) .option("OPTION (OPTIMIZE FOR UNKNOWN)") .execute();
You can also use this clause for any other database, that accepts hints or options at the same syntactic location, e.g. for DB2's isolation clause:
create.select(field1, field2) .from(table1) .option("WITH RR USE AND KEEP EXCLUSIVE LOCKS") .execute();
The outcome of such a query is this:
SELECT field1, field2 FROM table1 [option]
For SQL Server style table hints, see
Table.with(String)
- See Also:
Table.with(String)
-
addConnectBy
@Support({CUBRID,INFORMIX,ORACLE}) @Pro void addConnectBy(Condition condition)
Add an Oracle-specificCONNECT BY
clause to the query.
-
addConnectByNoCycle
@Support({CUBRID,INFORMIX,ORACLE}) @Pro void addConnectByNoCycle(Condition condition)
Add an Oracle-specificCONNECT BY NOCYCLE
clause to the query.
-
setConnectByStartWith
@Support({CUBRID,INFORMIX,ORACLE}) @Pro void setConnectByStartWith(Condition condition)
Add an Oracle-specificSTART WITH
clause to the query'sCONNECT BY
clause.
-
addConditions
@Support void addConditions(Condition condition)
Description copied from interface:ConditionProvider
Adds a new condition to the query, connecting them to existing conditions withOperator.AND
.- Specified by:
addConditions
in interfaceConditionProvider
- Parameters:
condition
- The condition
-
addConditions
@Support void addConditions(Condition... conditions)
Description copied from interface:ConditionProvider
Adds new conditions to the query, connecting them to existing conditions withOperator.AND
.- Specified by:
addConditions
in interfaceConditionProvider
- Parameters:
conditions
- The condition
-
addConditions
@Support void addConditions(Collection<? extends Condition> conditions)
Description copied from interface:ConditionProvider
Adds new conditions to the query, connecting them to existing conditions withOperator.AND
.- Specified by:
addConditions
in interfaceConditionProvider
- Parameters:
conditions
- The condition
-
addConditions
@Support void addConditions(Operator operator, Condition condition)
Description copied from interface:ConditionProvider
Adds a new condition to the query, connecting them to existing conditions with the provided operator.- Specified by:
addConditions
in interfaceConditionProvider
condition
- The condition
-
addConditions
@Support void addConditions(Operator operator, Condition... conditions)
Description copied from interface:ConditionProvider
Adds new conditions to the query, connecting them to existing conditions with the provided operator.- Specified by:
addConditions
in interfaceConditionProvider
conditions
- The condition
-
addConditions
@Support void addConditions(Operator operator, Collection<? extends Condition> conditions)
Description copied from interface:ConditionProvider
Adds new conditions to the query, connecting them to existing conditions with the provided operator.- Specified by:
addConditions
in interfaceConditionProvider
conditions
- The condition
-
addOrderBy
@Support void addOrderBy(OrderField<?>... fields)
Adds ordering fields.- Parameters:
fields
- The ordering fields
-
addOrderBy
@Support void addOrderBy(Collection<? extends OrderField<?>> fields)
Adds ordering fields.- Parameters:
fields
- The ordering fields
-
addOrderBy
@Support void addOrderBy(int... fieldIndexes)
Adds ordering fields.Indexes start at
1
in SQL!Note, you can use
addOrderBy(DSL.val(1).desc())
oraddOrderBy(DSL.literal(1).desc())
to apply descending ordering- Parameters:
fieldIndexes
- The ordering fields
-
setOrderBySiblings
@Support({CUBRID,INFORMIX,ORACLE}) @Pro void setOrderBySiblings(boolean orderBySiblings)
Indicate whether theSIBLINGS
keyword should be used in anORDER BY
clause to form anORDER SIBLINGS BY
clause.This clause can be used only along with Oracle's
CONNECT BY
clause, to indicate that the hierarchical ordering should be preserved and elements of each hierarchy should be ordered among themselves.- Parameters:
orderBySiblings
-
-
addSeekAfter
@Support void addSeekAfter(Field<?>... fields)
Adds seeking fields.- Parameters:
fields
- The seeking fields
-
addSeekAfter
@Support void addSeekAfter(Collection<? extends Field<?>> fields)
Adds seeking fields.- Parameters:
fields
- The seeking fields
-
addSeekBefore
@Deprecated @Support void addSeekBefore(Field<?>... fields)
Deprecated.- [#7461] - SEEK BEFORE is not implemented correctlyAdds seeking fields.- Parameters:
fields
- The seeking fields
-
addSeekBefore
@Deprecated @Support void addSeekBefore(Collection<? extends Field<?>> fields)
Deprecated.- [#7461] - SEEK BEFORE is not implemented correctlyAdds seeking fields.- Parameters:
fields
- The seeking fields
-
addOffset
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addOffset(int offset)
Add anOFFSET
clause to the query.If there is no
LIMIT .. OFFSET
orTOP
clause in your RDBMS, or if your RDBMS does not natively support offsets, this is emulated with aROW_NUMBER()
window function and nestedSELECT
statements.
-
addOffset
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addOffset(Number offset)
Add anOFFSET
clause to the query.If there is no
LIMIT .. OFFSET
orTOP
clause in your RDBMS, or if your RDBMS does not natively support offsets, this is emulated with aROW_NUMBER()
window function and nestedSELECT
statements.
-
addOffset
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addOffset(Param<? extends Number> offset)
Add anOFFSET
clause to the query using a named parameter.If there is no
LIMIT .. OFFSET
orTOP
clause in your RDBMS, or if your RDBMS does not natively support offsets, this is emulated with aROW_NUMBER()
window function and nestedSELECT
statements.
-
addLimit
@Support void addLimit(int numberOfRows)
Limit the results of this select.This is the same as calling
addLimit(int, int)
with offset = 0- Parameters:
numberOfRows
- The number of rows to return
-
addLimit
@Support void addLimit(Number numberOfRows)
Limit the results of this select.This is the same as calling
addLimit(int, int)
with offset = 0- Parameters:
numberOfRows
- The number of rows to return
-
addLimit
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addLimit(Param<? extends Number> numberOfRows)
Limit the results of this select using named parameters.Note that some dialects do not support bind values at all in
LIMIT
orTOP
clauses!If there is no
LIMIT
orTOP
clause in your RDBMS, or theLIMIT
orTOP
clause does not support bind values, this may be emulated with aROW_NUMBER()
window function and nestedSELECT
statements.This is the same as calling
addLimit(int, int)
with offset = 0- Parameters:
numberOfRows
- The number of rows to return
-
addLimit
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addLimit(int offset, int numberOfRows)
Limit the results of this select.Note that some dialects do not support bind values at all in
LIMIT
orTOP
clauses!If there is no
LIMIT
orTOP
clause in your RDBMS, or if your RDBMS does not natively support offsets, this is emulated with aROW_NUMBER()
window function and nestedSELECT
statements.- Parameters:
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return
-
addLimit
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addLimit(Number offset, Number numberOfRows)
Limit the results of this select.Note that some dialects do not support bind values at all in
LIMIT
orTOP
clauses!If there is no
LIMIT
orTOP
clause in your RDBMS, or if your RDBMS does not natively support offsets, this is emulated with aROW_NUMBER()
window function and nestedSELECT
statements.- Parameters:
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return
-
addLimit
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addLimit(Param<Integer> offset, int numberOfRows)
Limit the results of this select.Note that some dialects do not support bind values at all in
LIMIT
orTOP
clauses!If there is no
LIMIT
orTOP
clause in your RDBMS, or theLIMIT
orTOP
clause does not support bind values, or if your RDBMS does not natively support offsets, this may be emulated with aROW_NUMBER()
window function and nestedSELECT
statements.- Parameters:
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return
-
addLimit
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addLimit(Param<? extends Number> offset, Number numberOfRows)
Limit the results of this select.Note that some dialects do not support bind values at all in
LIMIT
orTOP
clauses!If there is no
LIMIT
orTOP
clause in your RDBMS, or theLIMIT
orTOP
clause does not support bind values, or if your RDBMS does not natively support offsets, this may be emulated with aROW_NUMBER()
window function and nestedSELECT
statements.- Parameters:
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return
-
addLimit
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addLimit(int offset, Param<Integer> numberOfRows)
Limit the results of this select using named parameters.Note that some dialects do not support bind values at all in
LIMIT
orTOP
clauses!If there is no
LIMIT
orTOP
clause in your RDBMS, or theLIMIT
orTOP
clause does not support bind values, or if your RDBMS does not natively support offsets, this may be emulated with aROW_NUMBER()
window function and nestedSELECT
statements.- Parameters:
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return
-
addLimit
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addLimit(Number offset, Param<? extends Number> numberOfRows)
Limit the results of this select using named parameters.Note that some dialects do not support bind values at all in
LIMIT
orTOP
clauses!If there is no
LIMIT
orTOP
clause in your RDBMS, or theLIMIT
orTOP
clause does not support bind values, or if your RDBMS does not natively support offsets, this may be emulated with aROW_NUMBER()
window function and nestedSELECT
statements.- Parameters:
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return
-
addLimit
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLITE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void addLimit(Param<? extends Number> offset, Param<? extends Number> numberOfRows)
Limit the results of this select using named parameters.Note that some dialects do not support bind values at all in
LIMIT
orTOP
clauses!If there is no
LIMIT
orTOP
clause in your RDBMS, or theLIMIT
orTOP
clause does not support bind values, or if your RDBMS does not natively support offsets, this may be emulated with aROW_NUMBER()
window function and nestedSELECT
statements.- Parameters:
offset
- The lowest offset starting at 0numberOfRows
- The number of rows to return
-
setLimitPercent
@Support({H2,ORACLE12C,SQLSERVER}) void setLimitPercent(boolean percent)
Add thePERCENT
clause to aLIMIT
clause.
-
setWithTies
@Support({AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,FIREBIRD_3_0,H2,HANA,INFORMIX,MARIADB,MYSQL_8_0,ORACLE,POSTGRES,REDSHIFT,SQLDATAWAREHOUSE,SQLSERVER,SYBASE,TERADATA,VERTICA}) void setWithTies(boolean withTies)
Add theWITH TIES
clause to aLIMIT
clause.
-
setForUpdate
@Support({ASE,AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,CUBRID,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLDATAWAREHOUSE,SQLSERVER,SYBASE,TERADATA}) void setForUpdate(boolean forUpdate)
Sets the "FOR UPDATE" lock mode onto the query.Native implementation
This has been observed to be supported by any of these dialects:
- DB2 FOR UPDATE and similar clauses
- Derby's FOR UPDATE clause
- H2's FOR UPDATE clause
- HSQLDB's FOR UPDATE clause
- MySQL's InnoDB locking reads
- Oracle's PL/SQL FOR UPDATE clause
- Postgres FOR UPDATE / FOR SHARE
Emulation
SQLDialect.SQLSERVER
: jOOQ will try to lock the database record usingWITH (ROWLOCK, UPDLOCK)
hints.Not supported
These dialects are known not to support the
FOR UPDATE
clause in regular SQL:If your dialect does not support this clause, jOOQ will still render it, if you apply it to your query. This might then cause syntax errors reported either by your database or your JDBC driver.
You shouldn't combine this with
setForShare(boolean)
- Parameters:
forUpdate
- The flag's value
-
setForNoKeyUpdate
@Support({AURORA_POSTGRES,COCKROACHDB,POSTGRES}) void setForNoKeyUpdate(boolean forNoKeyUpdate)
Sets the "FOR NO KEY UPDATE" lock mode onto the query.
-
setForUpdateOf
@Deprecated @Support({COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,SYBASE}) void setForUpdateOf(Field<?>... fields)
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeOf(Field...)
Some RDBMS allow for specifying the fields that should be locked by theFOR UPDATE
clause, instead of the full row.This automatically sets the
setForUpdate(boolean)
flag, and unsets thesetForShare(boolean)
flag, if it was previously set.This has been observed to be natively supported by any of these dialects:
- DB2
- Derby
- H2
- HSQLDB
- Ingres
- Oracle
- Sybase
Note, that
SQLDialect.DB2
has some stricter requirements regarding the updatability of fields. Refer to the DB2 documentation for further details- Parameters:
fields
- The fields that should be locked
-
setForUpdateOf
@Deprecated @Support({COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,SYBASE}) void setForUpdateOf(Collection<? extends Field<?>> fields)
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeOf(Collection)
Some RDBMS allow for specifying the fields that should be locked by theFOR UPDATE
clause, instead of the full row.- See Also:
setForUpdateOf(Field...)
-
setForUpdateOf
@Deprecated @Support({AURORA_POSTGRES,COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MYSQL_8_0,ORACLE,POSTGRES,SQLSERVER,SYBASE}) void setForUpdateOf(Table<?>... tables)
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeOf(Table...)
Some RDBMS allow for specifying the tables that should be locked by theFOR UPDATE
clause, instead of the full row.This automatically sets the
setForUpdate(boolean)
flag, and unsets thesetForShare(boolean)
flag, if it was previously set.This has been observed to be natively supported by any of these dialects:
- Postgres
- H2
- HSQLDB
- Sybase
jOOQ emulates this by locking all known fields of [
tables
] for any of these dialects:- DB2
- Derby
- Ingres
- Oracle
- Parameters:
tables
- The tables that should be locked
-
setForUpdateWait
@Deprecated @Support({MARIADB_10_3,ORACLE}) void setForUpdateWait(int seconds)
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeWait(int)
Some RDBMS allow for specifying the locking mode for the appliedFOR UPDATE
clause. In this case, the session will wait for someseconds
, before aborting the lock acquirement if the lock is not available.This automatically sets the
setForUpdate(boolean)
flag, and unsets thesetForShare(boolean)
flag, if it was previously set.This has been observed to be supported by any of these dialects:
- Oracle
- Parameters:
seconds
- The number of seconds to wait for a lock
-
setForUpdateNoWait
@Deprecated @Support({AURORA_POSTGRES,MARIADB_10_3,MYSQL_8_0,ORACLE,POSTGRES,SQLSERVER}) void setForUpdateNoWait()
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeNoWait()
Some RDBMS allow for specifying the locking mode for the appliedFOR UPDATE
clause. In this case, the session will not wait before aborting the lock acquirement if the lock is not available.This automatically sets the
setForUpdate(boolean)
flag, and unsets thesetForShare(boolean)
flag, if it was previously set.This has been observed to be supported by any of these dialects:
- Oracle
-
setForUpdateSkipLocked
@Deprecated @Support({AURORA_POSTGRES,MYSQL_8_0,ORACLE,POSTGRES_9_5,SQLSERVER}) void setForUpdateSkipLocked()
Deprecated.[#5218] - 3.14.0 - UsesetForLockModeSkipLocked()
Some RDBMS allow for specifying the locking mode for the appliedFOR UPDATE
clause. In this case, the session will skip all locked rows from the select statement, whose lock is not available.This automatically sets the
setForUpdate(boolean)
flag, and unsets thesetForShare(boolean)
flag, if it was previously set.This has been observed to be supported by any of these dialects:
- Oracle
-
setForShare
@Support({AURORA_MYSQL,AURORA_POSTGRES,COCKROACHDB,MARIADB,MYSQL,POSTGRES}) void setForShare(boolean forShare)
Sets the "FOR SHARE" lock mode onto the query.This has been observed to be supported by any of these dialects:
If your dialect does not support this clause, jOOQ will still render it, if you apply it to your query. This might then cause syntax errors reported either by your database or your JDBC driver.
You shouldn't combine this with
setForUpdate(boolean)
- Parameters:
forShare
- The flag's value
-
setForKeyShare
@Support({AURORA_POSTGRES,COCKROACHDB,POSTGRES}) void setForKeyShare(boolean forKeyShare)
Sets the "FOR KEY SHARE" lock mode onto the query.
-
setForLockModeOf
@Support({DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,SYBASE}) void setForLockModeOf(Field<?>... fields)
Some RDBMS allow for specifying the fields that should be locked by theFOR <lock_mode>
clause, instead of the full row.In case no lock mode has been set yet, it will implicitly be set to
UPDATE
(i.e.setForUpdate(boolean)
).Depending on the dialect and lock mode this flag may or may not be supported.
Note, that
SQLDialect.DB2
has some stricter requirements regarding the updatability of fields. Refer to the DB2 documentation for further details- Parameters:
fields
- The fields that should be locked
-
setForLockModeOf
@Support({DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,ORACLE,SYBASE}) void setForLockModeOf(Collection<? extends Field<?>> fields)
Some RDBMS allow for specifying the fields that should be locked by theFOR <lock_mode>
clause, instead of the full row.- See Also:
setForLockModeOf(Field...)
-
setForLockModeOf
@Support({AURORA_POSTGRES,COCKROACHDB,DB2,DERBY,FIREBIRD,H2,HANA,HSQLDB,INFORMIX,INGRES,MYSQL_8_0,ORACLE,POSTGRES,SQLSERVER,SYBASE}) void setForLockModeOf(Table<?>... tables)
Some RDBMS allow for specifying the tables that should be locked by theFOR <lock_mode>
clause, instead of the full row.In case no lock mode has been set yet, it will implicitly be set to
UPDATE
(i.e.setForUpdate(boolean)
).Depending on the dialect and lock mode this flag may or may not be supported.
- Parameters:
tables
- The tables that should be locked
-
setForLockModeWait
@Support({MARIADB_10_3,ORACLE}) void setForLockModeWait(int seconds)
Some RDBMS allow for specifying the locking mode for the appliedFOR <lock_mode>
clause. In this case, the session will wait for someseconds
, before aborting the lock acquirement if the lock is not available.In case no lock mode has been set yet, it will implicitly be set to
UPDATE
(i.e.setForUpdate(boolean)
).Depending on the dialect and lock mode this flag may or may not be supported.
- Parameters:
seconds
- The number of seconds to wait for a lock
-
setForLockModeNoWait
@Support({AURORA_POSTGRES,MARIADB_10_3,MYSQL_8_0,ORACLE,POSTGRES,SQLSERVER}) void setForLockModeNoWait()
Some RDBMS allow for specifying the locking mode for the appliedFOR <lock_mode>
clause. In this case, the session will not wait before aborting the lock acquirement if the lock is not available.In case no lock mode has been set yet, it will implicitly be set to
UPDATE
(i.e.setForUpdate(boolean)
).Depending on the dialect and lock mode this flag may or may not be supported.
-
setForLockModeSkipLocked
@Support({AURORA_POSTGRES,MYSQL_8_0,ORACLE,POSTGRES_9_5,SQLSERVER}) void setForLockModeSkipLocked()
Some RDBMS allow for specifying the locking mode for the appliedFOR <lock_mode>
clause. In this case, the session will skip all locked rows from the select statement, whose lock is not available.In case no lock mode has been set yet, it will implicitly be set to
UPDATE
(i.e.setForUpdate(boolean)
).Depending on the dialect and lock mode this flag may or may not be supported.
-
setForXMLRaw
@Support({DB2,ORACLE,POSTGRES,SQLSERVER}) @Pro void setForXMLRaw(boolean forXMLRaw)
Add aFOR XML RAW
clause to the end of the query.
-
setForXMLRaw
@Support({DB2,ORACLE,POSTGRES,SQLSERVER}) @Pro void setForXMLRaw(boolean forXMLRaw, String elementName)
Add aFOR XML RAW
clause to the end of the query.
-
setForXMLAuto
@Support({DB2,ORACLE,POSTGRES,SQLSERVER}) @Pro void setForXMLAuto(boolean forXMLAuto)
Add aFOR XML AUTO
clause to the end of the query.
-
setForXMLPath
@Support({DB2,ORACLE,POSTGRES,SQLSERVER}) @Pro void setForXMLPath(boolean forXMLPath)
Add aFOR XML PATH
clause to the end of the query.
-
setForXMLPath
@Support({DB2,ORACLE,POSTGRES,SQLSERVER}) @Pro void setForXMLPath(boolean forXMLPath, String elementName)
Add aFOR XML PATH
clause to the end of the query.
-
setForXMLRoot
@Support({DB2,ORACLE,POSTGRES,SQLSERVER}) @Pro void setForXMLRoot(boolean forXMLRoot)
Add aFOR XML ROOT
clause to the end of the query.
-
setForXMLRoot
@Support({DB2,ORACLE,POSTGRES,SQLSERVER}) @Pro void setForXMLRoot(boolean forXMLRoot, String rootName)
Add aFOR XML ROOT
clause to the end of the query.
-
setForXMLElements
@Support({DB2,ORACLE,POSTGRES,SQLSERVER}) @Pro void setForXMLElements(boolean forXMLElements)
Add aFOR XML ELEMENTS
clause to the end of the query.
-
setForJSONB
@Support({AURORA_POSTGRES,COCKROACHDB,DB2_11,H2,MARIADB_10_5,MYSQL_5_7,ORACLE12C,POSTGRES,SQLSERVER}) @Pro void setForJSONB(boolean forJSONB)
-
setForJSONAuto
@Support({AURORA_POSTGRES,COCKROACHDB,DB2_11,H2,MARIADB_10_5,MYSQL_5_7,ORACLE12C,POSTGRES,SQLSERVER}) @Pro void setForJSONAuto(boolean forJSONAuto)
Add aFOR JSON AUTO
clause to the end of the query.
-
setForJSONPath
@Support({AURORA_POSTGRES,COCKROACHDB,DB2_11,H2,MARIADB_10_5,MYSQL_5_7,ORACLE12C,POSTGRES,SQLSERVER}) @Pro void setForJSONPath(boolean forJSONPath)
Add aFOR JSON PATH
clause to the end of the query.
-
setForJSONRoot
@Support({AURORA_POSTGRES,COCKROACHDB,DB2_11,H2,MARIADB_10_5,MYSQL_5_7,ORACLE12C,POSTGRES,SQLSERVER}) @Pro void setForJSONRoot(boolean forJSONRoot)
Add aFOR JSON ROOT
clause to the end of the query.
-
setForJSONRoot
@Support({AURORA_POSTGRES,COCKROACHDB,DB2_11,H2,MARIADB_10_5,MYSQL_5_7,ORACLE12C,POSTGRES,SQLSERVER}) @Pro void setForJSONRoot(boolean forJSONRoot, String rootName)
Add aFOR JSON ROOT
clause to the end of the query.
-
setForJSONIncludeNullValues
@Support({AURORA_POSTGRES,COCKROACHDB,DB2_11,H2,MARIADB_10_5,MYSQL_5_7,ORACLE12C,POSTGRES,SQLSERVER}) @Pro void setForJSONIncludeNullValues(boolean forJSONIncludeNullValues)
Add aFOR JSON ROOT
clause to the end of the query.
-
setForJSONWithoutArrayWrapper
@Support({AURORA_POSTGRES,COCKROACHDB,DB2_11,H2,MARIADB_10_5,MYSQL_5_7,ORACLE12C,POSTGRES,SQLSERVER}) @Pro void setForJSONWithoutArrayWrapper(boolean forJSONWithoutArrayWrapper)
Add aFOR JSON ROOT
clause to the end of the query.
-
setWithCheckOption
@Support(ORACLE) @Pro void setWithCheckOption()
Add aWITH CHECK OPTION
clause to the end of the subquery.
-
-