spring-framework / org.springframework.jdbc.object

Package org.springframework.jdbc.object

Types

BatchSqlUpdate

open class BatchSqlUpdate : SqlUpdate

SqlUpdate subclass that performs batch update operations. Encapsulates queuing up records to be updated, and adds them as a single batch once flush is called or the given batch size has been met.

Note that this class is a non-thread-safe object, in contrast to all other JDBC operations objects in this package. You need to create a new instance of it for each use, or call reset before reuse within the same thread.

GenericSqlQuery

open class GenericSqlQuery<T : Any> : SqlQuery<T>

A concrete variant of SqlQuery which can be configured with a RowMapper.

GenericStoredProcedure

open class GenericStoredProcedure : StoredProcedure

Concrete implementation making it possible to define the RDBMS stored procedures in an application context without writing a custom Java implementation class.

This implementation does not provide a typed method for invocation so executions must use one of the generic StoredProcedure#execute(java.util.Map) or StoredProcedure#execute(org.springframework.jdbc.core.ParameterMapper) methods.

MappingSqlQuery

abstract class MappingSqlQuery<T : Any> : MappingSqlQueryWithParameters<T>

Reusable query in which concrete subclasses must implement the abstract mapRow(ResultSet, int) method to convert each row of the JDBC ResultSet into an object.

Simplifies MappingSqlQueryWithParameters API by dropping parameters and context. Most subclasses won't care about parameters. If you don't use contextual information, subclass this instead of MappingSqlQueryWithParameters.

SqlFunction

open class SqlFunction<T : Any> : MappingSqlQuery<T>

SQL "function" wrapper for a query that returns a single row of results. The default behavior is to return an int, but that can be overridden by using the constructor with an extra return type parameter.

Intended to use to call SQL functions that return a single result using a query like "select user()" or "select sysdate from dual". It is not intended for calling more complex stored functions or for using a CallableStatement to invoke a stored procedure or stored function. Use StoredProcedure or SqlCall for this type of processing.

This is a concrete class, which there is often no need to subclass. Code using this package can create an object of this type, declaring SQL and parameters, and then invoke the appropriate run method repeatedly to execute the function. Subclasses are only supposed to add specialized run methods for specific parameter and return types.

Like all RdbmsOperation objects, SqlFunction objects are thread-safe.

UpdatableSqlQuery

abstract class UpdatableSqlQuery<T : Any> : SqlQuery<T>

Reusable RDBMS query in which concrete subclasses must implement the abstract updateRow(ResultSet, int, context) method to update each row of the JDBC ResultSet and optionally map contents into an object.

Subclasses can be constructed providing SQL, parameter types and a DataSource. SQL will often vary between subclasses.