Top Description Methods
org.jooq

public Interface StoreQuery<R extends org.jooq.Record>

extends RowCountQuery
Known Direct Subinterfaces
org.jooq.InsertQuery, org.jooq.UpdateQuery
Known Direct Implementers
org.jooq.impl.AbstractStoreQuery
Type Parameters
<R>
The record type of the table being modified
Imports
java.util.Collection, .Map, org.jetbrains.annotations.NotNull, .Nullable

A query storing objects to the database. This is either an insert or an update query.

Instances of this type cannot be created directly, only of its subtypes.

Author
Lukas Eder

Method Summary

Modifier and TypeMethod and Description
public <T> void
addValue(Field<T>
The field
field
,
T
The value
value
)

Deprecated as a consequence of Field being deprecated.
Add a value to the store statement
public <T> void
addValue(Field<T>
The field
field
,
Field<T>
The value. If value is null, this results in calling addValue(Field, Object) with null as a value.
value
)

Deprecated as a consequence of Field being deprecated.
Add a value to the store statement
public void
addValues(Map<?, ?> map)

Add multiple values to the store statement.

public @NotNull Result<?>

Returns:

The returned values as specified by any of the setReturning() methods. Note:
  • Not all databases / JDBC drivers support returning several values on multi-row inserts!
  • This may return an empty Result in case jOOQ could not retrieve any generated keys from the JDBC driver.
getResult
()

The records holding returned values as specified by any of the setReturning() methods.

public R

Returns:

The returned value as specified by any of the setReturning() methods. This may return null in case jOOQ could not retrieve any generated keys from the JDBC driver.
getReturnedRecord
()

The record holding returned values as specified by any of the setReturning() methods.

public @NotNull Result<R>

Returns:

The returned values as specified by any of the setReturning() methods. Note:
  • Not all databases / JDBC drivers support returning several values on multi-row inserts!
  • This may return an empty Result in case jOOQ could not retrieve any generated keys from the JDBC driver.
getReturnedRecords
()

The records holding returned values as specified by any of the setReturning() methods.

public void
setRecord(R
The record holding values that are stored by the query
record
)

Add values to the store statement

public void
setReturning()

Configure the INSERT or UPDATE statement to return all fields in R.

public void
setReturning(Identity<R, ?>
The table's identity
identity
)

Configure the INSERT or UPDATE statement to return the generated identity value.

public void
setReturning(SelectFieldOrAsterisk...
Fields to be returned
fields
)

Configure the INSERT or UPDATE statement to return a list of fields in R.

public void
setReturning(Collection<? extends SelectFieldOrAsterisk>
Fields to be returned
fields
)

Configure the INSERT or UPDATE statement to return a list of fields in R.

Method Detail

addValueback to summary
public <T> void addValue(Field<T> field, T value)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Add a value to the store statement

Parameters
field:Field<T>

The field

value:T

The value

Annotations
@Support
addValueback to summary
public <T> void addValue(Field<T> field, Field<T> value)

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Add a value to the store statement

Parameters
field:Field<T>

The field

value:Field<T>

The value. If value is null, this results in calling addValue(Field, Object) with null as a value.

Annotations
@Support
addValuesback to summary
public void addValues(Map<?, ?> map)

Add multiple values to the store statement.

Keys can either be of type String, Name, or Field.

Values can either be of type <T> or Field<T>. jOOQ will attempt to convert values to their corresponding field's type.

Annotations
@Support
getResultback to summary
public @NotNull Result<?> getResult()

The records holding returned values as specified by any of the setReturning() methods.

This implemented differently for every dialect:

  • Firebird and Postgres have native support for INSERT … RETURNING and UPDATE … RETURNING clauses
  • HSQLDB, Oracle, and DB2 JDBC drivers allow for retrieving any table column as "generated key" in one statement
  • Derby, H2, Ingres, MySQL, SQL Server only allow for retrieving IDENTITY column values as "generated key". If other fields are requested, a second statement is issued. Client code must assure transactional integrity between the two statements.
  • Sybase and SQLite allow for retrieving IDENTITY values as @@identity or last_inserted_rowid() values. Those values are fetched in a separate SELECT statement. If other fields are requested, a second statement is issued. Client code must assure transactional integrity between the two statements.
Returns:@NotNull Result<?>

The returned values as specified by any of the setReturning() methods. Note:

  • Not all databases / JDBC drivers support returning several values on multi-row inserts!
  • This may return an empty Result in case jOOQ could not retrieve any generated keys from the JDBC driver.
Annotations
@NotNull
@Support
getReturnedRecordback to summary
public R getReturnedRecord()

The record holding returned values as specified by any of the setReturning() methods.

If the insert statement returns several records, this is the same as calling getReturnedRecords().get(0)

This implemented differently for every dialect:

  • Firebird and Postgres have native support for INSERT … RETURNING and UPDATE … RETURNING clauses
  • HSQLDB, Oracle, and DB2 JDBC drivers allow for retrieving any table column as "generated key" in one statement
  • Derby, H2, Ingres, MySQL, SQL Server only allow for retrieving IDENTITY column values as "generated key". If other fields are requested, a second statement is issued. Client code must assure transactional integrity between the two statements.
  • Sybase and SQLite allow for retrieving IDENTITY values as @@identity or last_inserted_rowid() values. Those values are fetched in a separate SELECT statement. If other fields are requested, a second statement is issued. Client code must assure transactional integrity between the two statements.
Returns:R

The returned value as specified by any of the setReturning() methods. This may return null in case jOOQ could not retrieve any generated keys from the JDBC driver.

Annotations
@Nullable
@Support
See Also
getReturnedRecords()
getReturnedRecordsback to summary
public @NotNull Result<R> getReturnedRecords()

The records holding returned values as specified by any of the setReturning() methods.

This implemented differently for every dialect:

  • Firebird and Postgres have native support for INSERT … RETURNING and UPDATE … RETURNING clauses
  • HSQLDB, Oracle, and DB2 JDBC drivers allow for retrieving any table column as "generated key" in one statement
  • Derby, H2, Ingres, MySQL, SQL Server only allow for retrieving IDENTITY column values as "generated key". If other fields are requested, a second statement is issued. Client code must assure transactional integrity between the two statements.
  • Sybase and SQLite allow for retrieving IDENTITY values as @@identity or last_inserted_rowid() values. Those values are fetched in a separate SELECT statement. If other fields are requested, a second statement is issued. Client code must assure transactional integrity between the two statements.

[#5070] Due to an early API design flaw, this method historically returns the type R, not a more generic type Record. This means that only actual columns in R can be returned. For a more generic set of column expressions, use getResult() instead.

Returns:@NotNull Result<R>

The returned values as specified by any of the setReturning() methods. Note:

  • Not all databases / JDBC drivers support returning several values on multi-row inserts!
  • This may return an empty Result in case jOOQ could not retrieve any generated keys from the JDBC driver.
Annotations
@NotNull
@Support
setRecordback to summary
public void setRecord(R record)

Add values to the store statement

Parameters
record:R

The record holding values that are stored by the query

Annotations
@Support
setReturningback to summary
public void setReturning()

Configure the INSERT or UPDATE statement to return all fields in R.

Annotations
@Support
See Also
getReturnedRecords()
setReturningback to summary
public void setReturning(Identity<R, ?> identity)

Configure the INSERT or UPDATE statement to return the generated identity value.

Parameters
identity:Identity<R, ?>

The table's identity

Annotations
@Support
See Also
getReturnedRecords()
setReturningback to summary
public void setReturning(SelectFieldOrAsterisk... fields)

Configure the INSERT or UPDATE statement to return a list of fields in R.

Parameters
fields:SelectFieldOrAsterisk[]

Fields to be returned

Annotations
@Support
See Also
getReturnedRecords()
setReturningback to summary
public void setReturning(Collection<? extends SelectFieldOrAsterisk> fields)

Configure the INSERT or UPDATE statement to return a list of fields in R.

Parameters
fields:Collection<? extends SelectFieldOrAsterisk>

Fields to be returned

Annotations
@Support
See Also
getReturnedRecords()