Class

org.springframework.scala.jdbc.core

JdbcTemplate

Related Doc: package core

Permalink

class JdbcTemplate extends AnyRef

Scala-based convenience wrapper for the Spring org.springframework.jdbc.core.JdbcTemplate, taking advantage of functions and Scala types, and exposing only the most commonly required operations in order to simplify JdbcTemplate usage.

Use the javaTemplate accessor to get access to the Java JdbcTemplate.

Since

1.0

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JdbcTemplate
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new JdbcTemplate(dataSource: DataSource)

    Permalink

    Construct a new JdbcTemplate, given a DataSource to obtain connections from.

    Construct a new JdbcTemplate, given a DataSource to obtain connections from.

    dataSource

    the JDBC DataSource to obtain connections from

  2. new JdbcTemplate(javaTemplate: jdbc.core.JdbcTemplate)

    Permalink

    Creates a JdbcTemplate that wraps the given Java template

    Creates a JdbcTemplate that wraps the given Java template

    javaTemplate

    the Java JdbcTemplate to wrap

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def batchUpdate[T](sql: String, batchArgs: Seq[T], batchSize: Int)(setterCallback: (PreparedStatement, T) ⇒ Unit): Seq[Seq[Int]]

    Permalink

    Execute multiple batches using the supplied SQL statement with the collect of supplied arguments.

    Execute multiple batches using the supplied SQL statement with the collect of supplied arguments. The arguments' values will be set using the function. Each batch should be of size indicated in 'batchSize'.

    sql

    the SQL statement to execute.

    batchArgs

    the Seq of Object sequences containing the batch of arguments for the query

    batchSize

    the batch size

    setterCallback

    function to set parameters on the PreparedStatement created by this method

    returns

    an array containing for each batch another array containing the numbers of rows affected by each update in the batch

    Annotations
    @throws( classOf[DataAccessException] )
  6. def batchUpdate(sql: String, batchArgs: Seq[Seq[Any]], types: Seq[Int]): Seq[Int]

    Permalink

    Execute a batch using the supplied SQL statement with the batch of supplied arguments.

    Execute a batch using the supplied SQL statement with the batch of supplied arguments.

    sql

    the SQL statement to execute.

    batchArgs

    the Seq of Object sequences containing the batch of arguments for the query

    types

    SQL types of the arguments (constants from java.sql.Types)

    returns

    an sequence containing the numbers of rows affected by each update in the batch

    Annotations
    @throws( classOf[DataAccessException] )
  7. def batchUpdate(sql: String, batchArgs: Seq[Seq[Any]]): Seq[Int]

    Permalink

    Execute a batch using the supplied SQL statement with the batch of supplied arguments.

    Execute a batch using the supplied SQL statement with the batch of supplied arguments.

    sql

    the SQL statement to execute

    batchArgs

    the Seq of Object sequences containing the batch of arguments for the query

    returns

    an sequence containing the numbers of rows affected by each update in the batch

    Annotations
    @throws( classOf[DataAccessException] )
  8. def batchUpdate(sql: String)(batchSize: ⇒ Int)(setterCallback: (PreparedStatement, Int) ⇒ Unit): Seq[Int]

    Permalink

    Issue multiple update statements on a single PreparedStatement, using batch updates and a function to set values.

    Issue multiple update statements on a single PreparedStatement, using batch updates and a function to set values.

    Will fall back to separate updates on a single PreparedStatement if the JDBC driver does not support batch updates.

    sql

    defining PreparedStatement that will be reused. All statements in the batch will use the same SQL.

    batchSize

    the size of the batch

    setterCallback

    function to set parameters on the PreparedStatement created by this method

    returns

    an sequence of the number of rows affected by each statement

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem issuing the update

  9. def batchUpdate(sql: Seq[String]): Seq[Int]

    Permalink

    Issue multiple SQL updates on a single JDBC Statement using batching.

    Issue multiple SQL updates on a single JDBC Statement using batching.

    Will fall back to separate updates on a single Statement if the JDBC driver does not support batch updates.

    sql

    defining an array of SQL statements that will be executed.

    returns

    an array of the number of rows affected by each statement

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the batch

  10. def call(statementCreator: (Connection) ⇒ CallableStatement)(declaredParameters: SqlParameter*): Map[String, Any]

    Permalink

    Execute a SQL call using a function to provide SQL and any required parameters.

    Execute a SQL call using a function to provide SQL and any required parameters.

    statementCreator

    object that provides SQL and any necessary parameters

    declaredParameters

    declared SqlParameter objects

    returns

    Map of extracted out parameters

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem issuing the update

  11. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  14. def execute(sql: String): Unit

    Permalink

    Issue a single SQL execute, typically a DDL statement.

    Issue a single SQL execute, typically a DDL statement.

    sql

    static SQL to execute

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  15. def executeCallable[T](callString: String)(statementCallback: (CallableStatement) ⇒ T): T

    Permalink

    Execute a JDBC data access operation, implemented as function working on a JDBC CallableStatement.

    Execute a JDBC data access operation, implemented as function working on a JDBC CallableStatement. 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 function can return a result object, for example a domain object or a collection of domain objects.

    callString

    the SQL call string to execute

    statementCallback

    function that specifies the action

    returns

    a result object returned by the action, or null

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  16. def executeCallable[T](statementCreator: (Connection) ⇒ CallableStatement, statementCallback: (CallableStatement) ⇒ T): T

    Permalink

    Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.CallableStatement.

    Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.CallableStatement. 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 function can return a result object, for example a domain object or a collection of domain objects.

    statementCreator

    function that can create a CallableStatement given a Connection

    statementCallback

    function that specifies the action

    returns

    a result object returned by the action, or null

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  17. def executeConnection[T](action: (Connection) ⇒ T): T

    Permalink

    Execute a JDBC data access operation, implemented as function working on a JDBC Connection.

    Execute a JDBC data access operation, implemented as function working on a JDBC Connection. This allows for implementing arbitrary data access operations, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.

    The callback function can return a result object, for example a domain object or a collection of domain objects.

    action

    the function that specifies the action

    returns

    a result object returned by the action, or null

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  18. def executePreparedStatement[T](sql: String)(statementCallback: (PreparedStatement) ⇒ T): T

    Permalink

    Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.PreparedStatement.

    Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.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 function can return a result object, for example a domain object or a collection of domain objects.

    sql

    SQL to execute

    statementCallback

    function that specifies the action

    returns

    a result object returned by the function, or null

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  19. def executePreparedStatement[T](statementCreator: (Connection) ⇒ PreparedStatement)(statementCallback: (PreparedStatement) ⇒ T): T

    Permalink

    Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.PreparedStatement.

    Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.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 function can return a result object, for example a domain object or a collection of domain objects.

    statementCreator

    function that can create a PreparedStatement given a Connection

    statementCallback

    function that specifies the action

    returns

    a result object returned by the function, or null

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  20. def executeStatement[T](action: (Statement) ⇒ T): T

    Permalink

    Execute a JDBC data access operation, implemented as function working on a JDBC Statement.

    Execute a JDBC data access operation, implemented as function working on a JDBC Statement. 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.

    action

    function that specifies the action

    returns

    a result object returned by the action, or null

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  21. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  25. val javaTemplate: jdbc.core.JdbcTemplate

    Permalink

    the Java JdbcTemplate to wrap

  26. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  28. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. def queryAndExtract[T](sql: String, args: Any*)(resultSetExtractor: (ResultSet) ⇒ T): T

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet with a function.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet with a function.

    sql

    SQL query to execute

    args

    arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain org.springframework.jdbc.core.SqlParameterValue objects which indicate not only the argument value but also the SQL type and optionally the scale

    resultSetExtractor

    function that will extract results

    returns

    an arbitrary result object, as returned by the function

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  30. def queryAndExtract[T](sql: String, args: Seq[Any], argTypes: Seq[Int])(resultSetExtractor: (ResultSet) ⇒ T): T

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet with a function.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet with a function.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    resultSetExtractor

    function that will extract results

    returns

    an arbitrary result object, as returned by the function

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  31. def queryAndExtract[T](statementCreator: (Connection) ⇒ PreparedStatement)(resultSetExtractor: (ResultSet) ⇒ T): T

    Permalink

    Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.

    Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.

    statementCreator

    function that can create a PreparedStatement given a Connection

    resultSetExtractor

    function that will extract results

    returns

    an arbitrary result object, as returned by the function

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  32. def queryAndMap[T](sql: String, args: Any*)(rowMapper: (ResultSet, Int) ⇒ T): Seq[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping each row to a Java object via a function.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping each row to a Java object via a function.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    rowMapper

    function that will map one object per row

    returns

    the result Seq, containing mapped objects

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  33. def queryAndMap[T](sql: String, args: Seq[Any], argTypes: Seq[Int])(rowMapper: (ResultSet, Int) ⇒ T): Seq[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping each row to a Java object via a function.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping each row to a Java object via a function.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    rowMapper

    function that will map one object per row

    returns

    the result Seq, containing mapped objects

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  34. def queryAndMap[T](statementCreator: (Connection) ⇒ PreparedStatement)(rowMapper: (ResultSet, Int) ⇒ T): Seq[T]

    Permalink

    Query using a prepared statement, mapping each row to a Java object via a function.

    Query using a prepared statement, mapping each row to a Java object via a function.

    statementCreator

    function that can create a PreparedStatement given a Connection

    rowMapper

    function that will map one object per row

    returns

    the result Seq, containing mapped objects

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  35. def queryAndMap[T](sql: String)(rowMapper: (ResultSet, Int) ⇒ T): Seq[T]

    Permalink

    Execute a query given static SQL, mapping each row to a Java object via a RowMapper.

    Execute a query given static SQL, mapping each row to a Java object via a RowMapper.

    sql

    SQL query to execute

    rowMapper

    function that will map one object per row

    returns

    the result List, containing mapped objects

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

  36. def queryAndProcess(sql: String, args: Any*)(rowProcessor: (ResultSet) ⇒ Unit): Unit

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet on a per-row basis with a function.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet on a per-row basis with a function.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    rowProcessor

    function that will extract results, one row at a time

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  37. def queryAndProcess(sql: String, args: Seq[Any], argTypes: Seq[Int])(rowProcessor: (ResultSet) ⇒ Unit): Unit

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet on a per-row basis with a function.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet on a per-row basis with a function.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    rowProcessor

    function that will extract results, one row at a time

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  38. def queryAndProcess(statementCreator: (Connection) ⇒ PreparedStatement)(rowProcessor: (ResultSet) ⇒ Unit): Unit

    Permalink

    Query using a prepared statement, reading the ResultSet on a per-row basis with a function.

    Query using a prepared statement, reading the ResultSet on a per-row basis with a function.

    statementCreator

    function that can create a PreparedStatement given a Connection

    rowProcessor

    function that will extract results, one row at a time

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  39. def queryAndProcess(sql: String)(rowCallback: (ResultSet) ⇒ Unit): Unit

    Permalink

    Execute a query given static SQL, reading the ResultSet on a per-row basis with a function.

    Execute a query given static SQL, reading the ResultSet on a per-row basis with a function.

    sql

    SQL query to execute

    rowCallback

    function that will extract results, one row at a time

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

  40. def queryForMap(sql: String, args: Any*): Map[String, Any]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result Map.

    Query given SQL to create a prepared statement from SQL and a sequence 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).

    sql

    SQL query to execute

    args

    arguments to bind to the query

    returns

    the result Map (one entry for each column, using the column name as the key)

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

    IncorrectResultSizeDataAccessException if the query does not return exactly one row

  41. def queryForMap(sql: String, args: Seq[Any], argTypes: Seq[Int]): Map[String, Any]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result Map.

    Query given SQL to create a prepared statement from SQL and a sequence 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).

    sql

    SQL query to execute

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    returns

    the result Map (one entry for each column, using the column name as the key)

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

    IncorrectResultSizeDataAccessException if the query does not return exactly one row

  42. def queryForMap(sql: String): Map[String, Any]

    Permalink

    Execute a query for a result Map, given static SQL.

    Execute a query for a result Map, given static SQL.

    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).

    sql

    SQL query to execute

    returns

    the result Map (one entry for each column, using the column name as the key)

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

    IncorrectResultSizeDataAccessException if the query does not return exactly one row

  43. def queryForMappedColumns(sql: String, args: Any*): Seq[Map[String, Any]]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.

    The results will be mapped to a Seq (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 queryForMap() methods.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    returns

    a Seq that contains a Map per row

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  44. def queryForMappedColumns[T](sql: String, args: Seq[Any], argTypes: Seq[Int]): Seq[Map[String, Any]]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.

    The results will be mapped to a Seq (one entry for each row) of Maps (one entry for each column, using the column name as the key). Thus each element in the list will be of the form returned by this interface's queryForMap() methods.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    returns

    a Seq that contains a Map per row

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  45. def queryForMappedColumns(sql: String): Seq[Map[String, Any]]

    Permalink

    Execute a query for a result list, given static SQL.

    Execute a query for a result list, given static SQL.

    The results will be mapped to a Seq (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 class's queryForMap() method.

    sql

    SQL query to execute

    returns

    an Seq that contains a Map per row

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

  46. def queryForObject[T](sql: String, args: Any*)(implicit arg0: ClassTag[T]): Option[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result object.

    Query given SQL to create a prepared statement from SQL and a sequence 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.

    T

    the type that the result object is expected to match

    sql

    SQL query to execute

    args

    arguments to bind to the query

    returns

    an option value containing the result object of the required type, or None in case of SQL NULL

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

    IncorrectResultSizeDataAccessException if the query does not return exactly one row, or does not return exactly one column in that row

  47. def queryForObject[T](sql: String, args: Seq[Any], argTypes: Seq[Int])(implicit arg0: ClassTag[T]): Option[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result object.

    Query given SQL to create a prepared statement from SQL and a sequence 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.

    T

    the type that the result object is expected to match

    sql

    SQL query to execute

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    returns

    an option value containing the result object of the required type, or None in case of SQL NULL

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

    IncorrectResultSizeDataAccessException if the query does not return exactly one row, or does not return exactly one column in that row

  48. def queryForObject[T](sql: String)(implicit arg0: ClassTag[T]): Option[T]

    Permalink

    Execute a query for a result object, given static SQL.

    Execute a query for a result object, given static SQL.

    This method is useful for running static SQL with a known outcome. The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.

    sql

    SQL query to execute

    returns

    an option value containing the result object of the required type, or None in case of SQL NULL

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

    IncorrectResultSizeDataAccessException if the query does not return exactly one row, or does not return exactly one column in that row

  49. def queryForObjectAndMap[T](sql: String, args: Any*)(rowMapper: (ResultSet, Int) ⇒ T): Option[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping a single result row to a Java object via a function.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping a single result row to a Java object via a function.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    rowMapper

    function that will map one object per row

    returns

    an option value containing the single mapped object; or None

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

    IncorrectResultSizeDataAccessException if the query does not return exactly one row

  50. def queryForObjectAndMap[T](sql: String, args: Seq[Any], argTypes: Seq[Int])(rowMapper: (ResultSet, Int) ⇒ T): Option[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping a single result row to a Java object via a function.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping a single result row to a Java object via a function.

    sql

    SQL query to execute

    args

    arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type)

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    rowMapper

    object that will map one object per row

    returns

    an option value containing the single mapped object; or None

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

    IncorrectResultSizeDataAccessException if the query does not return exactly one row

  51. def queryForObjectAndMap[T](sql: String)(rowMapper: (ResultSet, Int) ⇒ T): T

    Permalink

    Execute a query given static SQL, mapping a single result row to a Java object via a row mapping function.

    Execute a query given static SQL, mapping a single result row to a Java object via a row mapping function.

    sql

    SQL query to execute

    rowMapper

    function that will map one object per row

    returns

    the single mapped object

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

    IncorrectResultSizeDataAccessException if the query does not return exactly one row

  52. def queryForRowSet(sql: String, args: Any*): SqlRowSet

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a SqlRowSet.

    Query given SQL to create a prepared statement from SQL and a sequence 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.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    returns

    a SqlRowSet representation

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

  53. def queryForRowSet(sql: String, args: Seq[Any], argTypes: Seq[Int]): SqlRowSet

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a SqlRowSet.

    Query given SQL to create a prepared statement from SQL and a sequence 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.

    sql

    SQL query to execute

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    returns

    a SqlRowSet representation

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

  54. def queryForRowSet(sql: String): SqlRowSet

    Permalink

    Execute a query for a SqlRowSet, given static SQL.

    Execute a query for a SqlRowSet, given static SQL.

    The results will be mapped to an SqlRowSet which holds the data in a disconnected fashion. This wrapper will translate any SQLExceptions thrown.

    sql

    SQL query to execute

    returns

    a SqlRowSet representation

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

  55. def queryForSeq[T](sql: String, args: Any*)(implicit arg0: ClassTag[T]): Seq[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.

    The results will be mapped to a Seq (one entry for each row) of result objects, each of them matching the specified element type.

    T

    the required type of element in the result list

    sql

    SQL query to execute

    args

    arguments to bind to the query

    returns

    a Seq of objects that match the specified element type

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  56. def queryForSeq[T](sql: String, args: Seq[Any], argTypes: Seq[Int])(implicit arg0: ClassTag[T]): Seq[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.

    Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.

    The results will be mapped to a Seq (one entry for each row) of result objects, each of them matching the specified element type.

    T

    the required type of element in the result list

    sql

    SQL query to execute

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    returns

    a Seq of objects that match the specified element type

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  57. def queryForSeq[T](sql: String)(implicit arg0: ClassTag[T]): Seq[T]

    Permalink

    Execute a query for a result sequence, given static SQL.

    Execute a query for a result sequence, given static SQL.

    The results will be mapped to a Seq (one entry for each row) of result objects, each of them matching the specified element type.

    T

    the required type of element in the result list

    sql

    SQL query to execute

    returns

    a Seq of objects that match the specified element type

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem executing the query

  58. def queryWithSetterAndExtract[T](sql: String)(preparedStatementSetter: (PreparedStatement) ⇒ Unit)(resultSetExtractor: (ResultSet) ⇒ T): T

    Permalink

    Query using a prepared statement, reading the ResultSet with a function.

    Query using a prepared statement, reading the ResultSet with a function.

    sql

    SQL query to execute

    preparedStatementSetter

    function that knows how to set values on the prepared statement.

    resultSetExtractor

    function that will extract results

    returns

    an arbitrary result object, as returned by the function

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem

  59. def queryWithSetterAndMap[T](sql: String)(setterCallback: (PreparedStatement) ⇒ Unit)(rowMapper: (ResultSet, Int) ⇒ T): Seq[T]

    Permalink

    Query given SQL to create a prepared statement from SQL and a function implementation that knows how to bind values to the query, mapping each row to a Java object via a function.

    Query given SQL to create a prepared statement from SQL and a function implementation that knows how to bind values to the query, mapping each row to a Java object via a function.

    sql

    SQL query to execute

    setterCallback

    function that knows how to set values on the prepared statement

    rowMapper

    function that will map one object per row

    returns

    the result Seq, containing mapped objects

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  60. def queryWithSetterAndProcess(sql: String)(preparedStatementSetter: (PreparedStatement) ⇒ Unit)(rowProcessor: (ResultSet) ⇒ Unit): Unit

    Permalink

    Query given SQL to create a prepared statement from SQL and a function that knows how to bind values to the query, reading the ResultSet on a per-row basis with another function.

    Query given SQL to create a prepared statement from SQL and a function that knows how to bind values to the query, reading the ResultSet on a per-row basis with another function.

    sql

    SQL query to execute

    preparedStatementSetter

    function that knows how to set values on the prepared statement.

    rowProcessor

    function that will extract results, one row at a time

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if the query fails

  61. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  62. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  63. def update(sql: String, args: Any*): Int

    Permalink

    Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.

    Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.

    sql

    SQL containing bind parameters

    args

    arguments to bind to the query

    returns

    the number of rows affected

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem issuing the update

  64. def update(sql: String, args: Seq[Any], argTypes: Seq[Int]): Int

    Permalink

    Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.

    Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.

    sql

    SQL containing bind parameters

    args

    arguments to bind to the query

    argTypes

    SQL types of the arguments (constants from java.sql.Types)

    returns

    the number of rows affected

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem issuing the update

  65. def update(generatedKeyHolder: KeyHolder)(statementCreator: (Connection) ⇒ PreparedStatement): Int

    Permalink

    Issue an update statement using a function to provide SQL and any required parameters.

    Issue an update statement using a function to provide SQL and any required parameters. Generated keys will be put into the given KeyHolder.

    Note that the given PreparedStatementCreator has to create a statement with activated extraction of generated keys (a JDBC 3.0 feature). This can either be done directly or through using a PreparedStatementCreatorFactory.

    generatedKeyHolder

    KeyHolder that will hold the generated keys

    statementCreator

    object that provides SQL and any necessary parameters

    returns

    the number of rows affected

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem issuing the update

  66. def update(statementCreator: (Connection) ⇒ PreparedStatement): Int

    Permalink

    Issue a single SQL update operation (such as an insert, update or delete statement) using a function to provide SQL and any required parameters.

    Issue a single SQL update operation (such as an insert, update or delete statement) using a function to provide SQL and any required parameters.

    statementCreator

    function that provides SQL and any necessary parameters

    returns

    the number of rows affected

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem issuing the update

  67. def update(sql: String): Int

    Permalink

    Issue a single SQL update operation (such as an insert, update or delete statement).

    Issue a single SQL update operation (such as an insert, update or delete statement).

    sql

    static SQL to execute

    returns

    the number of rows affected

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem.

  68. def updateWithSetter(sql: String)(preparedStatementSetter: (PreparedStatement) ⇒ Unit): Int

    Permalink

    Issue an update statement using a function to set bind parameters, with given SQL.

    Issue an update statement using a function to set bind parameters, with given SQL.

    sql

    SQL containing bind parameters

    preparedStatementSetter

    helper function that sets bind parameters. If this is null} we run an update with static SQL.

    returns

    the number of rows affected

    Annotations
    @throws( classOf[DataAccessException] )
    Exceptions thrown

    DataAccessException if there is any problem issuing the update

  69. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  70. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  71. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped