open class SimpleJdbcInsert : AbstractJdbcInsert, SimpleJdbcInsertOperations
A SimpleJdbcInsert is a multi-threaded, reusable object providing easy insert capabilities for a table. It provides meta data processing to simplify the code needed to construct a basic insert statement. All you need to provide is the name of the table and a Map containing the column names and the column values.
The meta data processing is based on the DatabaseMetaData provided by the JDBC driver. As long as the JDBC driver can provide the names of the columns for a specified table than we can rely on this auto-detection feature. If that is not the case, then the column names must be specified explicitly.
The actual insert is being handled using Spring's org.springframework.jdbc.core.JdbcTemplate.
Many of the configuration methods return the current instance of the SimpleJdbcInsert to provide the ability to chain multiple ones together in a "fluent" interface style.
Author
Thomas Risberg
Since
2.5
See Also
java.sql.DatabaseMetaDataorg.springframework.jdbc.core.JdbcTemplate
SimpleJdbcInsert(dataSource: DataSource)
Constructor that takes one parameter with the JDBC DataSource to use when creating the JdbcTemplate. SimpleJdbcInsert(jdbcTemplate: JdbcTemplate)
Alternative Constructor that takes one parameter with the JdbcTemplate to be used. |
open fun execute(args: MutableMap<String, *>): Intopen fun execute(parameterSource: SqlParameterSource): Int |
|
open fun executeAndReturnKey(args: MutableMap<String, *>): Numberopen fun executeAndReturnKey(parameterSource: SqlParameterSource): Number |
|
open fun executeAndReturnKeyHolder(args: MutableMap<String, *>): KeyHolderopen fun executeAndReturnKeyHolder(parameterSource: SqlParameterSource): KeyHolder |
|
open fun executeBatch(vararg batch: MutableMap<String, *>): IntArrayopen fun executeBatch(vararg batch: SqlParameterSource): IntArray |
|
open fun includeSynonymsForTableColumnMetaData(): SimpleJdbcInsertOperations |
|
open fun usingColumns(vararg columnNames: String): SimpleJdbcInsert |
|
open fun usingGeneratedKeyColumns(vararg columnNames: String): SimpleJdbcInsert |
|
open fun withCatalogName(catalogName: String): SimpleJdbcInsert |
|
open fun withSchemaName(schemaName: String): SimpleJdbcInsert |
|
open fun withTableName(tableName: String): SimpleJdbcInsert |
|
open fun withoutTableColumnMetaDataAccess(): SimpleJdbcInsertOperations |