public interface

SimpleJdbcInsertOperations

org.springframework.jdbc.core.simple.SimpleJdbcInsertOperations
Known Indirect Subclasses

Class Overview

Interface specifying the API for a Simple JDBC Insert implemented by SimpleJdbcInsert. This interface is not often used directly, but provides the option to enhance testability, as it can easily be mocked or stubbed.

Summary

Public Methods
abstract int execute(Map<StringObject> args)
Execute the insert using the values passed in.
abstract int execute(SqlParameterSource parameterSource)
Execute the insert using the values passed in.
abstract Number executeAndReturnKey(SqlParameterSource parameterSource)
Execute the insert using the values passed in and return the generated key.
abstract Number executeAndReturnKey(Map<StringObject> args)
Execute the insert using the values passed in and return the generated key.
abstract KeyHolder executeAndReturnKeyHolder(SqlParameterSource parameterSource)
Execute the insert using the values passed in and return the generated keys.
abstract KeyHolder executeAndReturnKeyHolder(Map<StringObject> args)
Execute the insert using the values passed in and return the generated keys.
abstract int[] executeBatch(SqlParameterSource[] batch)
Execute a batch insert using the batch of values passed in.
abstract int[] executeBatch(Map[]<StringObject> batch)
Execute a batch insert using the batch of values passed in.
abstract SimpleJdbcInsertOperations includeSynonymsForTableColumnMetaData()
Include synonyms for the column meta data lookups via JDBC.
abstract SimpleJdbcInsertOperations useNativeJdbcExtractorForMetaData(NativeJdbcExtractor nativeJdbcExtractor)
Use a the provided NativeJdbcExtractor during the column meta data lookups via JDBC.
abstract SimpleJdbcInsertOperations usingColumns(String... columnNames)
Specify the column names that the insert statement should be limited to use.
abstract SimpleJdbcInsertOperations usingGeneratedKeyColumns(String... columnNames)
Specify the name sof any columns that have auto generated keys.
abstract SimpleJdbcInsertOperations withCatalogName(String catalogName)
Specify the catalog name, if any, to be used for the insert.
abstract SimpleJdbcInsertOperations withSchemaName(String schemaName)
Specify the shema name, if any, to be used for the insert.
abstract SimpleJdbcInsertOperations withTableName(String tableName)
Specify the table name to be used for the insert.
abstract SimpleJdbcInsertOperations withoutTableColumnMetaDataAccess()
Turn off any processing of column meta data information obtained via JDBC.

Public Methods

public abstract int execute (Map<StringObject> args)

Execute the insert using the values passed in.

Parameters
args Map containing column names and corresponding value
Returns
  • the number of rows affected as returned by the JDBC driver

public abstract int execute (SqlParameterSource parameterSource)

Execute the insert using the values passed in.

Parameters
parameterSource SqlParameterSource containing values to use for insert
Returns
  • the number of rows affected as returned by the JDBC driver

public abstract Number executeAndReturnKey (SqlParameterSource parameterSource)

Execute the insert using the values passed in and return the generated key. This requires that the name of the columns with auto generated keys have been specified. This method will always return a key or throw an exception if a key was not returned.

Parameters
parameterSource SqlParameterSource containing values to use for insert
Returns
  • the generated key value.

public abstract Number executeAndReturnKey (Map<StringObject> args)

Execute the insert using the values passed in and return the generated key. This requires that the name of the columns with auto generated keys have been specified. This method will always return a key or throw an exception if a key was not returned.

Parameters
args Map containing column names and corresponding value
Returns
  • the generated key value

public abstract KeyHolder executeAndReturnKeyHolder (SqlParameterSource parameterSource)

Execute the insert using the values passed in and return the generated keys. This requires that the name of the columns with auto generated keys have been specified. This method will always return a KeyHolder but the caller must verify that it actually contains the generated keys.

Parameters
parameterSource SqlParameterSource containing values to use for insert
Returns
  • the KeyHolder containing all generated keys

public abstract KeyHolder executeAndReturnKeyHolder (Map<StringObject> args)

Execute the insert using the values passed in and return the generated keys. This requires that the name of the columns with auto generated keys have been specified. This method will always return a KeyHolder but the caller must verify that it actually contains the generated keys.

Parameters
args Map containing column names and corresponding value
Returns
  • the KeyHolder containing all generated keys

public abstract int[] executeBatch (SqlParameterSource[] batch)

Execute a batch insert using the batch of values passed in.

Parameters
batch an array of SqlParameterSource containing values for the batch
Returns
  • the array of number of rows affected as returned by the JDBC driver

public abstract int[] executeBatch (Map[]<StringObject> batch)

Execute a batch insert using the batch of values passed in.

Parameters
batch an array of Maps containing a batch of column names and corresponding value
Returns
  • the array of number of rows affected as returned by the JDBC driver

public abstract SimpleJdbcInsertOperations includeSynonymsForTableColumnMetaData ()

Include synonyms for the column meta data lookups via JDBC. Note: this is only necessary to include for Oracle since other databases supporting synonyms seems to include the synonyms automatically.

Returns
  • the instance of this SimpleJdbcInsert

public abstract SimpleJdbcInsertOperations useNativeJdbcExtractorForMetaData (NativeJdbcExtractor nativeJdbcExtractor)

Use a the provided NativeJdbcExtractor during the column meta data lookups via JDBC. Note: this is only necessary to include when running with a connection pool that wraps the meta data connection and when using a database like Oracle where it is necessary to access the native connection to include synonyms.

Returns
  • the instance of this SimpleJdbcInsert

public abstract SimpleJdbcInsertOperations usingColumns (String... columnNames)

Specify the column names that the insert statement should be limited to use.

Parameters
columnNames one or more column names
Returns
  • the instance of this SimpleJdbcInsert

public abstract SimpleJdbcInsertOperations usingGeneratedKeyColumns (String... columnNames)

Specify the name sof any columns that have auto generated keys.

Parameters
columnNames one or more column names
Returns
  • the instance of this SimpleJdbcInsert

public abstract SimpleJdbcInsertOperations withCatalogName (String catalogName)

Specify the catalog name, if any, to be used for the insert.

Parameters
catalogName the name of the catalog
Returns
  • the instance of this SimpleJdbcInsert

public abstract SimpleJdbcInsertOperations withSchemaName (String schemaName)

Specify the shema name, if any, to be used for the insert.

Parameters
schemaName the name of the schema
Returns
  • the instance of this SimpleJdbcInsert

public abstract SimpleJdbcInsertOperations withTableName (String tableName)

Specify the table name to be used for the insert.

Parameters
tableName the name of the stored table
Returns
  • the instance of this SimpleJdbcInsert

public abstract SimpleJdbcInsertOperations withoutTableColumnMetaDataAccess ()

Turn off any processing of column meta data information obtained via JDBC.

Returns
  • the instance of this SimpleJdbcInsert