interface NamedParameterJdbcOperations
Interface specifying a basic set of JDBC operations allowing the use of named parameters rather than the traditional '?' placeholders.
This is an alternative to the classic org.springframework.jdbc.core.JdbcOperations interface, implemented by NamedParameterJdbcTemplate. This interface is not often used directly, but provides a useful option to enhance testability, as it can easily be mocked or stubbed.
Author
Thomas Risberg
Author
Juergen Hoeller
Since
2.0
See Also
NamedParameterJdbcTemplateorg.springframework.jdbc.core.JdbcOperations
abstract fun batchUpdate(sql: String, batchValues: Array<MutableMap<String, *>>): IntArray
Executes a batch using the supplied SQL statement with the batch of supplied arguments. abstract fun batchUpdate(sql: String, batchArgs: Array<SqlParameterSource>): IntArray
Execute a batch using the supplied SQL statement with the batch of supplied arguments. |
|
abstract fun <T : Any> execute(sql: String, paramSource: SqlParameterSource, action: PreparedStatementCallback<T>): Tabstract fun <T : Any> execute(sql: String, paramMap: MutableMap<String, *>, action: PreparedStatementCallback<T>): Tabstract fun <T : Any> execute(sql: String, action: PreparedStatementCallback<T>): T
Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy. The callback action can return a result object, for example a domain object or a collection of domain objects. |
|
abstract fun getJdbcOperations(): JdbcOperations
Expose the classic Spring JdbcTemplate to allow invocation of classic JDBC operations. |
|
abstract fun <T : Any> query(sql: String, paramSource: SqlParameterSource, rse: ResultSetExtractor<T>): Tabstract fun <T : Any> query(sql: String, paramMap: MutableMap<String, *>, rse: ResultSetExtractor<T>): T
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor. abstract fun <T : Any> query(sql: String, rse: ResultSetExtractor<T>): T
Query given SQL to create a prepared statement from SQL, reading the ResultSet with a ResultSetExtractor. Note: In contrast to the JdbcOperations method with the same signature, this query variant always uses a PreparedStatement. It is effectively equivalent to a query call with an empty parameter Map. abstract fun query(sql: String, paramSource: SqlParameterSource, rch: RowCallbackHandler): Unitabstract fun query(sql: String, paramMap: MutableMap<String, *>, rch: RowCallbackHandler): Unit
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler. abstract fun query(sql: String, rch: RowCallbackHandler): Unit
Query given SQL to create a prepared statement from SQL, reading the ResultSet on a per-row basis with a RowCallbackHandler. Note: In contrast to the JdbcOperations method with the same signature, this query variant always uses a PreparedStatement. It is effectively equivalent to a query call with an empty parameter Map. abstract fun <T : Any> query(sql: String, paramSource: SqlParameterSource, rowMapper: RowMapper<T>): MutableList<T>abstract fun <T : Any> query(sql: String, paramMap: MutableMap<String, *>, rowMapper: RowMapper<T>): MutableList<T>
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a Java object via a RowMapper. abstract fun <T : Any> query(sql: String, rowMapper: RowMapper<T>): MutableList<T>
Query given SQL to create a prepared statement from SQL, mapping each row to a Java object via a RowMapper. Note: In contrast to the JdbcOperations method with the same signature, this query variant always uses a PreparedStatement. It is effectively equivalent to a query call with an empty parameter Map. |
|
abstract fun <T : Any> queryForList(sql: String, paramSource: SqlParameterSource, elementType: Class<T>): MutableList<T>abstract fun <T : Any> queryForList(sql: String, paramMap: MutableMap<String, *>, elementType: Class<T>): MutableList<T>
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. The results will be mapped to a List (one entry for each row) of result objects, each of them matching the specified element type. abstract fun queryForList(sql: String, paramSource: SqlParameterSource): MutableList<MutableMap<String, Any>>abstract fun queryForList(sql: String, paramMap: MutableMap<String, *>): MutableList<MutableMap<String, Any>>
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. The results will be mapped to a List (one entry for each row) of Maps (one entry for each column, using the column name as the key). Each element in the list will be of the form returned by this interface's |
|
abstract fun queryForMap(sql: String, paramSource: SqlParameterSource): MutableMap<String, Any>
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result Map. The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key). abstract fun queryForMap(sql: String, paramMap: MutableMap<String, *>): MutableMap<String, Any>
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result Map. The queryForMap() methods defined by this interface are appropriate when you don't have a domain model. Otherwise, consider using one of the queryForObject() methods. The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key). |
|
abstract fun <T : Any> queryForObject(sql: String, paramSource: SqlParameterSource, rowMapper: RowMapper<T>): Tabstract fun <T : Any> queryForObject(sql: String, paramMap: MutableMap<String, *>, rowMapper: RowMapper<T>): T
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a Java object via a RowMapper. abstract fun <T : Any> queryForObject(sql: String, paramSource: SqlParameterSource, requiredType: Class<T>): Tabstract fun <T : Any> queryForObject(sql: String, paramMap: MutableMap<String, *>, requiredType: Class<T>): T
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object. The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type. |
|
abstract fun queryForRowSet(sql: String, paramSource: SqlParameterSource): SqlRowSetabstract fun queryForRowSet(sql: String, paramMap: MutableMap<String, *>): SqlRowSet
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a SqlRowSet. The results will be mapped to an SqlRowSet which holds the data in a disconnected fashion. This wrapper will translate any SQLExceptions thrown. Note that, for the default implementation, JDBC RowSet support needs to be available at runtime: by default, Sun's |
|
abstract fun update(sql: String, paramSource: SqlParameterSource): Intabstract fun update(sql: String, paramMap: MutableMap<String, *>): Int
Issue an update via a prepared statement, binding the given arguments. abstract fun update(sql: String, paramSource: SqlParameterSource, generatedKeyHolder: KeyHolder): Intabstract fun update(sql: String, paramSource: SqlParameterSource, generatedKeyHolder: KeyHolder, keyColumnNames: Array<String>): Int
Issue an update via a prepared statement, binding the given arguments, returning generated keys. |