接口 SimpleJdbcInsertOperations
- 所有已知实现类:
SimpleJdbcInsert
public interface SimpleJdbcInsertOperations
Interface specifying the API for a Simple JDBC Insert implemented bySimpleJdbcInsert
. This interface is not often used directly, but provides the option to enhance testability, as it can easily be mocked or stubbed.- 从以下版本开始:
- 2.5
- 作者:
- Thomas Risberg
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 int
execute(Map<String,?> args)
Execute the insert using the values passed in.int
execute(SqlParameterSource parameterSource)
Execute the insert using the values passed in.Number
executeAndReturnKey(Map<String,?> args)
Execute the insert using the values passed in and return the generated key.Number
executeAndReturnKey(SqlParameterSource parameterSource)
Execute the insert using the values passed in and return the generated key.KeyHolder
executeAndReturnKeyHolder(Map<String,?> args)
Execute the insert using the values passed in and return the generated keys.KeyHolder
executeAndReturnKeyHolder(SqlParameterSource parameterSource)
Execute the insert using the values passed in and return the generated keys.int[]
executeBatch(Map<String,?>... batch)
Execute a batch insert using the batch of values passed in.int[]
executeBatch(SqlParameterSource... batch)
Execute a batch insert using the batch of values passed in.SimpleJdbcInsertOperations
includeSynonymsForTableColumnMetaData()
Include synonyms for the column meta-data lookups via JDBC.SimpleJdbcInsertOperations
useNativeJdbcExtractorForMetaData(NativeJdbcExtractor nativeJdbcExtractor)
Use a the provided NativeJdbcExtractor during the column meta data lookups via JDBC.SimpleJdbcInsertOperations
usingColumns(String... columnNames)
Specify the column names that the insert statement should be limited to use.SimpleJdbcInsertOperations
usingGeneratedKeyColumns(String... columnNames)
Specify the names of any columns that have auto generated keys.SimpleJdbcInsertOperations
withCatalogName(String catalogName)
Specify the catalog name, if any, to be used for the insert.SimpleJdbcInsertOperations
withoutTableColumnMetaDataAccess()
Turn off any processing of column meta-data information obtained via JDBC.SimpleJdbcInsertOperations
withSchemaName(String schemaName)
Specify the schema name, if any, to be used for the insert.SimpleJdbcInsertOperations
withTableName(String tableName)
Specify the table name to be used for the insert.
方法详细资料
withTableName
SimpleJdbcInsertOperations withTableName(String tableName)
Specify the table name to be used for the insert.- 参数:
tableName
- the name of the stored table- 返回:
- the instance of this SimpleJdbcInsert
withSchemaName
SimpleJdbcInsertOperations withSchemaName(String schemaName)
Specify the schema name, if any, to be used for the insert.- 参数:
schemaName
- the name of the schema- 返回:
- the instance of this SimpleJdbcInsert
withCatalogName
SimpleJdbcInsertOperations withCatalogName(String catalogName)
Specify the catalog name, if any, to be used for the insert.- 参数:
catalogName
- the name of the catalog- 返回:
- the instance of this SimpleJdbcInsert
usingColumns
SimpleJdbcInsertOperations usingColumns(String... columnNames)
Specify the column names that the insert statement should be limited to use.- 参数:
columnNames
- one or more column names- 返回:
- the instance of this SimpleJdbcInsert
usingGeneratedKeyColumns
SimpleJdbcInsertOperations usingGeneratedKeyColumns(String... columnNames)
Specify the names of any columns that have auto generated keys.- 参数:
columnNames
- one or more column names- 返回:
- the instance of this SimpleJdbcInsert
withoutTableColumnMetaDataAccess
SimpleJdbcInsertOperations withoutTableColumnMetaDataAccess()
Turn off any processing of column meta-data information obtained via JDBC.- 返回:
- the instance of this SimpleJdbcInsert
includeSynonymsForTableColumnMetaData
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.
- 返回:
- the instance of this SimpleJdbcInsert
useNativeJdbcExtractorForMetaData
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.
- 返回:
- the instance of this SimpleJdbcInsert
execute
int execute(Map<String,?> args)
Execute the insert using the values passed in.- 参数:
args
- Map containing column names and corresponding value- 返回:
- the number of rows affected as returned by the JDBC driver
execute
int execute(SqlParameterSource parameterSource)
Execute the insert using the values passed in.- 参数:
parameterSource
- SqlParameterSource containing values to use for insert- 返回:
- the number of rows affected as returned by the JDBC driver
executeAndReturnKey
Number executeAndReturnKey(Map<String,?> 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 KeyHolder but the caller must verify that it actually contains the generated keys.
- 参数:
args
- Map containing column names and corresponding value- 返回:
- the generated key value
executeAndReturnKey
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 KeyHolder but the caller must verify that it actually contains the generated keys.
- 参数:
parameterSource
- SqlParameterSource containing values to use for insert- 返回:
- the generated key value.
executeAndReturnKeyHolder
KeyHolder executeAndReturnKeyHolder(Map<String,?> 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.
- 参数:
args
- Map containing column names and corresponding value- 返回:
- the KeyHolder containing all generated keys
executeAndReturnKeyHolder
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.
- 参数:
parameterSource
- SqlParameterSource containing values to use for insert- 返回:
- the KeyHolder containing all generated keys
executeBatch
int[] executeBatch(Map<String,?>... batch)
Execute a batch insert using the batch of values passed in.- 参数:
batch
- an array of Maps containing a batch of column names and corresponding value- 返回:
- the array of number of rows affected as returned by the JDBC driver
executeBatch
int[] executeBatch(SqlParameterSource... batch)
Execute a batch insert using the batch of values passed in.- 参数:
batch
- an array of SqlParameterSource containing values for the batch- 返回:
- the array of number of rows affected as returned by the JDBC driver