public interface InsertResultStep<R extends Record> extends Insert<R>
Insert
's DSL API.
Example:
DSLContext create = DSL.using(configuration);
TableRecord<?> record =
create.insertInto(table, field1, field2)
.values(value1, value2)
.returning(field1)
.fetchOne();
This implemented differently for every dialect:
SELECT .. FROM FINAL TABLE (INSERT ...)
@@identity
or last_inserted_rowid()
values. Those
values are fetched in a separate SELECT
statement. If other
fields are requested, another statement is issued. Client code must assure
transactional integrity between these statements.Modifier and Type | Method and Description |
---|---|
Result<R> |
fetch()
The result holding returned values as specified by the
InsertReturningStep . |
R |
fetchOne()
The record holding returned values as specified by the
InsertReturningStep . |
java.util.Optional<R> |
fetchOptional()
The record holding returned values as specified by the
InsertReturningStep . |
bind, bind, cancel, close, execute, executeAsync, executeAsync, getBindValues, getParam, getParams, getSQL, getSQL, getSQL, isExecutable, keepStatement, queryTimeout
attach, configuration, detach
@Support Result<R> fetch() throws DataAccessException
InsertReturningStep
.InsertReturningStep
. Note:
Result
in case jOOQ could not retrieve any generated
keys from the JDBC driver.DataAccessException
- if something went wrong executing the queryInsertQuery.getReturnedRecords()
@Support R fetchOne() throws DataAccessException, TooManyRowsException
InsertReturningStep
.InsertReturningStep
. This may return null
in
case jOOQ could not retrieve any generated keys from the JDBC
driver.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordInsertQuery.getReturnedRecord()
@Support java.util.Optional<R> fetchOptional() throws DataAccessException, TooManyRowsException
InsertReturningStep
.InsertReturningStep
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordInsertQuery.getReturnedRecord()
Copyright © 2018. All Rights Reserved.