org.jooq
Interface InsertResultStep<R extends Record>

All Superinterfaces:
Adapter, Attachable, Insert<R>, Query, QueryPart, Serializable

public interface InsertResultStep<R extends Record>
extends Insert<R>

This type is used for the Insert's DSL API.

Example:

 Factory create = new Factory();

 TableRecord record =
 create.insertInto(table, field1, field2)
       .values(value1, value2)
       .returning(field1)
       .fetchOne();
 

This implemented differently for every dialect:

Author:
Lukas Eder

Method Summary
 Result<R> fetch()
          The result holding returned values as specified by the InsertReturningStep This currently only works well for DB2, HSQLDB, MySQL, and Postgres
 R fetchOne()
          The record holding returned values as specified by the InsertReturningStep
 
Methods inherited from interface org.jooq.Query
bind, bind, execute, getBindValues, getParam, getParams, getSQL, getSQL, isExecutable
 
Methods inherited from interface org.jooq.QueryPart
attach
 
Methods inherited from interface org.jooq.Adapter
internalAPI
 

Method Detail

fetch

Result<R> fetch()
                               throws DataAccessException
The result holding returned values as specified by the InsertReturningStep

This currently only works well for DB2, HSQLDB, MySQL, and Postgres

Returns:
The returned values as specified by the InsertReturningStep. 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.
Throws:
DataAccessException - if something went wrong executing the query
See Also:
InsertQuery.getReturnedRecords()

fetchOne

R fetchOne()
                          throws DataAccessException
The record holding returned values as specified by the InsertReturningStep

Returns:
The returned value as specified by the InsertReturningStep. This may return null in case jOOQ could not retrieve any generated keys from the JDBC driver.
Throws:
DataAccessException - if something went wrong executing the query
See Also:
InsertQuery.getReturnedRecord()


Copyright © 2012. All Rights Reserved.