Java Doc for JdbcOperations.java in  » J2EE » spring-framework-2.5 » org » springframework » jdbc » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.jdbc.core 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.jdbc.core.JdbcOperations

All known Subclasses:   org.springframework.jdbc.core.JdbcTemplate,
JdbcOperations
public interface JdbcOperations (Code)
Interface specifying a basic set of JDBC operations. Implemented by JdbcTemplate . Not often used directly, but a useful option to enhance testability, as it can easily be mocked or stubbed.

Alternatively, the standard JDBC infrastructure can be mocked. However, mocking this interface constitutes significantly less work. As an alternative to a mock objects approach to testing data access code, consider the powerful integration testing support provided in the org.springframework.test package, shipped in spring-mock.jar.
author:
   Rod Johnson
author:
   Juergen Hoeller
See Also:   JdbcTemplate





Method Summary
 int[]batchUpdate(String[] sql)
     Issue multiple SQL updates on a single Statement, using JDBC 2.0 batching.

Will fall back to separate updates on a single Statement if the JDBC driver does not support batch updates.
Parameters:
  sql - defining an array of SQL statements that will be executed.

 int[]batchUpdate(String sql, BatchPreparedStatementSetter pss)
     Issue multiple updates on a single PreparedStatement, using JDBC 2.0 batch updates and a BatchPreparedStatementSetter to set values.
 Mapcall(CallableStatementCreator csc, List declaredParameters)
     Execute a SQL call using a CallableStatementCreator to provide SQL and any required parameters.
 Objectexecute(ConnectionCallback action)
     Execute a JDBC data access operation, implemented as callback action working on a JDBC Connection.
 Objectexecute(StatementCallback action)
     Execute a JDBC data access operation, implemented as callback action working on a JDBC Statement.
 voidexecute(String sql)
     Issue a single SQL execute, typically a DDL statement.
 Objectexecute(PreparedStatementCreator psc, PreparedStatementCallback action)
     Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement.
 Objectexecute(String sql, PreparedStatementCallback action)
     Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement.
 Objectexecute(CallableStatementCreator csc, CallableStatementCallback action)
     Execute a JDBC data access operation, implemented as callback action working on a JDBC CallableStatement.
 Objectexecute(String callString, CallableStatementCallback action)
     Execute a JDBC data access operation, implemented as callback action working on a JDBC CallableStatement.
 Objectquery(String sql, ResultSetExtractor rse)
     Execute a query given static SQL, reading the ResultSet with a ResultSetExtractor.

Uses a JDBC Statement, not a PreparedStatement.

 voidquery(String sql, RowCallbackHandler rch)
     Execute a query given static SQL, reading the ResultSet on a per-row basis with a RowCallbackHandler.

Uses a JDBC Statement, not a PreparedStatement.

 Listquery(String sql, RowMapper rowMapper)
     Execute a query given static SQL, mapping each row to a Java object via a RowMapper.

Uses a JDBC Statement, not a PreparedStatement.

 Objectquery(PreparedStatementCreator psc, ResultSetExtractor rse)
     Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.
 Objectquery(String sql, PreparedStatementSetter pss, ResultSetExtractor rse)
     Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.
 Objectquery(String sql, Object[] args, int[] argTypes, ResultSetExtractor rse)
     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.
 Objectquery(String sql, Object[] args, ResultSetExtractor rse)
     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.
 voidquery(PreparedStatementCreator psc, RowCallbackHandler rch)
     Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler.
 voidquery(String sql, PreparedStatementSetter pss, RowCallbackHandler rch)
     Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.
 voidquery(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch)
     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.
 voidquery(String sql, Object[] args, RowCallbackHandler rch)
     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.
 Listquery(PreparedStatementCreator psc, RowMapper rowMapper)
     Query using a prepared statement, mapping each row to a Java object via a RowMapper.
 Listquery(String sql, PreparedStatementSetter pss, RowMapper rowMapper)
     Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a Java object via a RowMapper.
 Listquery(String sql, Object[] args, int[] argTypes, RowMapper rowMapper)
     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.
 Listquery(String sql, Object[] args, RowMapper rowMapper)
     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.
 intqueryForInt(String sql)
     Execute a query that results in an int value, given static SQL.

Uses a JDBC Statement, not a PreparedStatement.

 intqueryForInt(String sql, Object[] args, int[] argTypes)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in an int value.
 intqueryForInt(String sql, Object[] args)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in an int value.
 ListqueryForList(String sql, Class elementType)
     Execute a query for a result list, given static SQL.

Uses a JDBC Statement, not a PreparedStatement.

 ListqueryForList(String sql)
     Execute a query for a result list, given static SQL.

Uses a JDBC Statement, not a PreparedStatement.

 ListqueryForList(String sql, Object[] args, int[] argTypes, Class elementType)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.
 ListqueryForList(String sql, Object[] args, Class elementType)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.
 ListqueryForList(String sql, Object[] args, int[] argTypes)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.
 ListqueryForList(String sql, Object[] args)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list.
 longqueryForLong(String sql)
     Execute a query that results in a long value, given static SQL.

Uses a JDBC Statement, not a PreparedStatement.

 longqueryForLong(String sql, Object[] args, int[] argTypes)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in a long value.
 longqueryForLong(String sql, Object[] args)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in a long value.
 MapqueryForMap(String sql)
     Execute a query for a result Map, given static SQL.

Uses a JDBC Statement, not a PreparedStatement.

 MapqueryForMap(String sql, Object[] args, int[] argTypes)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result Map.
 MapqueryForMap(String sql, Object[] args)
     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.
 ObjectqueryForObject(String sql, RowMapper rowMapper)
     Execute a query given static SQL, mapping a single result row to a Java object via a RowMapper.

Uses a JDBC Statement, not a PreparedStatement.

 ObjectqueryForObject(String sql, Class requiredType)
     Execute a query for a result object, given static SQL.

Uses a JDBC Statement, not a PreparedStatement.

 ObjectqueryForObject(String sql, Object[] args, int[] argTypes, RowMapper rowMapper)
     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.
 ObjectqueryForObject(String sql, Object[] args, RowMapper rowMapper)
     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.
 ObjectqueryForObject(String sql, Object[] args, int[] argTypes, Class requiredType)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object.
 ObjectqueryForObject(String sql, Object[] args, Class requiredType)
     Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object.
 SqlRowSetqueryForRowSet(String sql)
     Execute a query for a SqlRowSet, given static SQL.

Uses a JDBC Statement, not a PreparedStatement.

 SqlRowSetqueryForRowSet(String sql, Object[] args, int[] argTypes)
     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.

 SqlRowSetqueryForRowSet(String sql, Object[] args)
     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.

 intupdate(String sql)
     Issue a single SQL update.
 intupdate(PreparedStatementCreator psc)
     Issue an update using a PreparedStatementCreator to provide SQL and any required parameters.
 intupdate(PreparedStatementCreator psc, KeyHolder generatedKeyHolder)
     Issue an update using a PreparedStatementCreator to provide SQL and any required parameters.
 intupdate(String sql, PreparedStatementSetter pss)
     Issue an update using a PreparedStatementSetter to set bind parameters, with given SQL.
 intupdate(String sql, Object[] args, int[] argTypes)
     Issue an update via a prepared statement, binding the given arguments.
 intupdate(String sql, Object[] args)
     Issue an update via a prepared statement, binding the given arguments.



Method Detail
batchUpdate
int[] batchUpdate(String[] sql) throws DataAccessException(Code)
Issue multiple SQL updates on a single Statement, using JDBC 2.0 batching.

Will fall back to separate updates on a single Statement if the JDBC driver does not support batch updates.
Parameters:
  sql - defining an array of SQL statements that will be executed. an array of the number of rows affected by each statement
throws:
  DataAccessException - if there is any problem executing the batch




batchUpdate
int[] batchUpdate(String sql, BatchPreparedStatementSetter pss) throws DataAccessException(Code)
Issue multiple updates on a single PreparedStatement, using JDBC 2.0 batch updates and a BatchPreparedStatementSetter to set values.

Will fall back to separate updates on a single PreparedStatement if the JDBC driver does not support batch updates.
Parameters:
  sql - defining PreparedStatement that will be reused.All statements in the batch will use the same SQL.
Parameters:
  pss - object to set parameters on the PreparedStatementcreated by this method an array of the number of rows affected by each statement
throws:
  DataAccessException - if there is any problem issuing the update




call
Map call(CallableStatementCreator csc, List declaredParameters) throws DataAccessException(Code)
Execute a SQL call using a CallableStatementCreator to provide SQL and any required parameters.
Parameters:
  csc - object that provides SQL and any necessary parameters
Parameters:
  declaredParameters - list of declared SqlParameter objects Map of extracted out parameters
throws:
  DataAccessException - if there is any problem issuing the update



execute
Object execute(ConnectionCallback action) throws DataAccessException(Code)
Execute a JDBC data access operation, implemented as callback action 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 action can return a result object, for example a domain object or a collection of domain objects.
Parameters:
  action - the callback object that specifies the action a result object returned by the action, or null
throws:
  DataAccessException - if there is any problem




execute
Object execute(StatementCallback action) throws DataAccessException(Code)
Execute a JDBC data access operation, implemented as callback action 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.
Parameters:
  action - callback object that specifies the action a result object returned by the action, or null
throws:
  DataAccessException - if there is any problem




execute
void execute(String sql) throws DataAccessException(Code)
Issue a single SQL execute, typically a DDL statement.
Parameters:
  sql - static SQL to execute
throws:
  DataAccessException - if there is any problem



execute
Object execute(PreparedStatementCreator psc, PreparedStatementCallback action) throws DataAccessException(Code)
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.
Parameters:
  psc - object that can create a PreparedStatement given a Connection
Parameters:
  action - callback object that specifies the action a result object returned by the action, or null
throws:
  DataAccessException - if there is any problem




execute
Object execute(String sql, PreparedStatementCallback action) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL to execute
Parameters:
  action - callback object that specifies the action a result object returned by the action, or null
throws:
  DataAccessException - if there is any problem




execute
Object execute(CallableStatementCreator csc, CallableStatementCallback action) throws DataAccessException(Code)
Execute a JDBC data access operation, implemented as callback action 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 callback action can return a result object, for example a domain object or a collection of domain objects.
Parameters:
  csc - object that can create a CallableStatement given a Connection
Parameters:
  action - callback object that specifies the action a result object returned by the action, or null
throws:
  DataAccessException - if there is any problem




execute
Object execute(String callString, CallableStatementCallback action) throws DataAccessException(Code)
Execute a JDBC data access operation, implemented as callback action 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 callback action can return a result object, for example a domain object or a collection of domain objects.
Parameters:
  callString - the SQL call string to execute
Parameters:
  action - callback object that specifies the action a result object returned by the action, or null
throws:
  DataAccessException - if there is any problem




query
Object query(String sql, ResultSetExtractor rse) throws DataAccessException(Code)
Execute a query given static SQL, reading the ResultSet with a ResultSetExtractor.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded query method with null as argument array.
Parameters:
  sql - SQL query to execute
Parameters:
  rse - object that will extract all rows of results an arbitrary result object, as returned by the ResultSetExtractor
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.query(String,Object[],ResultSetExtractor)




query
void query(String sql, RowCallbackHandler rch) throws DataAccessException(Code)
Execute a query given static SQL, reading the ResultSet on a per-row basis with a RowCallbackHandler.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded query method with null as argument array.
Parameters:
  sql - SQL query to execute
Parameters:
  rch - object that will extract results, one row at a time
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.query(String,Object[],RowCallbackHandler)




query
List query(String sql, RowMapper rowMapper) throws DataAccessException(Code)
Execute a query given static SQL, mapping each row to a Java object via a RowMapper.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded query method with null as argument array.
Parameters:
  sql - SQL query to execute
Parameters:
  rowMapper - object that will map one object per row the result List, containing mapped objects
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.query(String,Object[],RowMapper)




query
Object query(PreparedStatementCreator psc, ResultSetExtractor rse) throws DataAccessException(Code)
Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.
Parameters:
  psc - object that can create a PreparedStatement given a Connection
Parameters:
  rse - object that will extract results an arbitrary result object, as returned by the ResultSetExtractor
throws:
  DataAccessException - if there is any problem
See Also:   PreparedStatementCreatorFactory




query
Object query(String sql, PreparedStatementSetter pss, ResultSetExtractor rse) throws DataAccessException(Code)
Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.
Parameters:
  sql - SQL query to execute
Parameters:
  pss - object that knows how to set values on the prepared statement.If this is null, the SQL will be assumed to contain no bind parameters.Even if there are no bind parameters, this object may be used toset fetch size and other performance options.
Parameters:
  rse - object that will extract results an arbitrary result object, as returned by the ResultSetExtractor
throws:
  DataAccessException - if there is any problem



query
Object query(String sql, Object[] args, int[] argTypes, ResultSetExtractor rse) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types)
Parameters:
  rse - object that will extract results an arbitrary result object, as returned by the ResultSetExtractor
throws:
  DataAccessException - if the query fails
See Also:   java.sql.Types



query
Object query(String sql, Object[] args, ResultSetExtractor rse) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale
Parameters:
  rse - object that will extract results an arbitrary result object, as returned by the ResultSetExtractor
throws:
  DataAccessException - if the query fails



query
void query(PreparedStatementCreator psc, RowCallbackHandler rch) throws DataAccessException(Code)
Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.
Parameters:
  psc - object that can create a PreparedStatement given a Connection
Parameters:
  rch - object that will extract results, one row at a time
throws:
  DataAccessException - if there is any problem
See Also:   PreparedStatementCreatorFactory




query
void query(String sql, PreparedStatementSetter pss, RowCallbackHandler rch) throws DataAccessException(Code)
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler.
Parameters:
  sql - SQL query to execute
Parameters:
  pss - object that knows how to set values on the prepared statement.If this is null, the SQL will be assumed to contain no bind parameters.Even if there are no bind parameters, this object may be used toset fetch size and other performance options.
Parameters:
  rch - object that will extract results, one row at a time
throws:
  DataAccessException - if the query fails



query
void query(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types)
Parameters:
  rch - object that will extract results, one row at a time
throws:
  DataAccessException - if the query fails
See Also:   java.sql.Types



query
void query(String sql, Object[] args, RowCallbackHandler rch) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale
Parameters:
  rch - object that will extract results, one row at a time
throws:
  DataAccessException - if the query fails



query
List query(PreparedStatementCreator psc, RowMapper rowMapper) throws DataAccessException(Code)
Query using a prepared statement, mapping each row to a Java object via a RowMapper.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.
Parameters:
  psc - object that can create a PreparedStatement given a Connection
Parameters:
  rowMapper - object that will map one object per row the result List, containing mapped objects
throws:
  DataAccessException - if there is any problem
See Also:   PreparedStatementCreatorFactory




query
List query(String sql, PreparedStatementSetter pss, RowMapper rowMapper) throws DataAccessException(Code)
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a Java object via a RowMapper.
Parameters:
  sql - SQL query to execute
Parameters:
  pss - object that knows how to set values on the prepared statement.If this is null, the SQL will be assumed to contain no bind parameters.Even if there are no bind parameters, this object may be used toset fetch size and other performance options.
Parameters:
  rowMapper - object that will map one object per row the result List, containing mapped objects
throws:
  DataAccessException - if the query fails



query
List query(String sql, Object[] args, int[] argTypes, RowMapper rowMapper) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types)
Parameters:
  rowMapper - object that will map one object per row the result List, containing mapped objects
throws:
  DataAccessException - if the query fails
See Also:   java.sql.Types



query
List query(String sql, Object[] args, RowMapper rowMapper) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale
Parameters:
  rowMapper - object that will map one object per row the result List, containing mapped objects
throws:
  DataAccessException - if the query fails



queryForInt
int queryForInt(String sql) throws DataAccessException(Code)
Execute a query that results in an int value, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded queryForInt method with null as argument array.

This method is useful for running static SQL with a known outcome. The query is expected to be a single row/single column query that results in an int value.
Parameters:
  sql - SQL query to execute the int value, or 0 in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForInt(String,Object[])




queryForInt
int queryForInt(String sql, Object[] args, int[] argTypes) throws DataAccessException(Code)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in an int value.

The query is expected to be a single row/single column query that results in an int value.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types) the int value, or 0 in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForInt(String)
See Also:   java.sql.Types




queryForInt
int queryForInt(String sql, Object[] args) throws DataAccessException(Code)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in an int value.

The query is expected to be a single row/single column query that results in an int value.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale the int value, or 0 in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForInt(String)




queryForList
List queryForList(String sql, Class elementType) throws DataAccessException(Code)
Execute a query for a result list, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded queryForList method with null as argument array.

The results will be mapped to a List (one entry for each row) of result objects, each of them matching the specified element type.
Parameters:
  sql - SQL query to execute
Parameters:
  elementType - the required type of element in the result list(for example, Integer.class) a List of objects that match the specified element type
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForList(String,Object[],Class)
See Also:   SingleColumnRowMapper




queryForList
List queryForList(String sql) throws DataAccessException(Code)
Execute a query for a result list, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded queryForList method with null as argument array.

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 queryForMap() methods.
Parameters:
  sql - SQL query to execute an List that contains a Map per row
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForList(String,Object[])




queryForList
List queryForList(String sql, Object[] args, int[] argTypes, Class elementType) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types)
Parameters:
  elementType - the required type of element in the result list(for example, Integer.class) a List of objects that match the specified element type
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForList(String,Class)
See Also:   SingleColumnRowMapper




queryForList
List queryForList(String sql, Object[] args, Class elementType) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale
Parameters:
  elementType - the required type of element in the result list(for example, Integer.class) a List of objects that match the specified element type
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForList(String,Class)
See Also:   SingleColumnRowMapper




queryForList
List queryForList(String sql, Object[] args, int[] argTypes) throws DataAccessException(Code)
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). Thus Each element in the list will be of the form returned by this interface's queryForMap() methods.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types) a List that contains a Map per row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForList(String)
See Also:   java.sql.Types




queryForList
List queryForList(String sql, Object[] args) throws DataAccessException(Code)
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 queryForMap() methods.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale a List that contains a Map per row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForList(String)




queryForLong
long queryForLong(String sql) throws DataAccessException(Code)
Execute a query that results in a long value, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded queryForLong method with null as argument array.

This method is useful for running static SQL with a known outcome. The query is expected to be a single row/single column query that results in a long value.
Parameters:
  sql - SQL query to execute the long value, or 0 in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForLong(String,Object[])




queryForLong
long queryForLong(String sql, Object[] args, int[] argTypes) throws DataAccessException(Code)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in a long value.

The query is expected to be a single row/single column query that results in a long value.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types) the long value, or 0 in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForLong(String)
See Also:   java.sql.Types




queryForLong
long queryForLong(String sql, Object[] args) throws DataAccessException(Code)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, resulting in a long value.

The query is expected to be a single row/single column query that results in a long value.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale the long value, or 0 in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForLong(String)




queryForMap
Map queryForMap(String sql) throws DataAccessException(Code)
Execute a query for a result Map, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded queryForMap method with null as argument array.

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).
Parameters:
  sql - SQL query to execute the result Map (one entry for each column, using thecolumn name as the key)
throws:
  IncorrectResultSizeDataAccessException - if the query does notreturn exactly one row
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForMap(String,Object[])
See Also:   ColumnMapRowMapper




queryForMap
Map queryForMap(String sql, Object[] args, int[] argTypes) throws DataAccessException(Code)
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).
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types) the result Map (one entry for each column, using thecolumn name as the key)
throws:
  IncorrectResultSizeDataAccessException - if the query does notreturn exactly one row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForMap(String)
See Also:   ColumnMapRowMapper
See Also:   java.sql.Types




queryForMap
Map queryForMap(String sql, Object[] args) throws DataAccessException(Code)
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).
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale the result Map (one entry for each column, using thecolumn name as the key)
throws:
  IncorrectResultSizeDataAccessException - if the query does notreturn exactly one row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForMap(String)
See Also:   ColumnMapRowMapper




queryForObject
Object queryForObject(String sql, RowMapper rowMapper) throws DataAccessException(Code)
Execute a query given static SQL, mapping a single result row to a Java object via a RowMapper.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded queryForObject method with null as argument array.
Parameters:
  sql - SQL query to execute
Parameters:
  rowMapper - object that will map one object per row the single mapped object
throws:
  IncorrectResultSizeDataAccessException - if the query does notreturn exactly one row
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForObject(String,Object[],RowMapper)




queryForObject
Object queryForObject(String sql, Class requiredType) throws DataAccessException(Code)
Execute a query for a result object, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded queryForObject method with null as argument array.

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.
Parameters:
  sql - SQL query to execute
Parameters:
  requiredType - the type that the result object is expected to match the result object of the required type, or null in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForObject(String,Object[],Class)




queryForObject
Object queryForObject(String sql, Object[] args, int[] argTypes, RowMapper rowMapper) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type)
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types)
Parameters:
  rowMapper - object that will map one object per row the single mapped object
throws:
  IncorrectResultSizeDataAccessException - if the query does notreturn exactly one row
throws:
  DataAccessException - if the query fails



queryForObject
Object queryForObject(String sql, Object[] args, RowMapper rowMapper) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale
Parameters:
  rowMapper - object that will map one object per row the single mapped object
throws:
  IncorrectResultSizeDataAccessException - if the query does notreturn exactly one row
throws:
  DataAccessException - if the query fails



queryForObject
Object queryForObject(String sql, Object[] args, int[] argTypes, Class requiredType) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types)
Parameters:
  requiredType - the type that the result object is expected to match the result object of the required type, or null in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForObject(String,Class)
See Also:   java.sql.Types




queryForObject
Object queryForObject(String sql, Object[] args, Class requiredType) throws DataAccessException(Code)
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.
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale
Parameters:
  requiredType - the type that the result object is expected to match the result object of the required type, or null in case of SQL NULL
throws:
  IncorrectResultSizeDataAccessException - if the query does not returnexactly one row, or does not return exactly one column in that row
throws:
  DataAccessException - if the query fails
See Also:   JdbcOperations.queryForObject(String,Class)




queryForRowSet
SqlRowSet queryForRowSet(String sql) throws DataAccessException(Code)
Execute a query for a SqlRowSet, given static SQL.

Uses a JDBC Statement, not a PreparedStatement. If you want to execute a static query with a PreparedStatement, use the overloaded queryForRowSet method with null as argument array.

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 that, for the default implementation, JDBC RowSet support needs to be available at runtime: by default, Sun's com.sun.rowset.CachedRowSetImpl class is used, which is part of JDK 1.5+ and also available separately as part of Sun's JDBC RowSet Implementations download (rowset.jar).
Parameters:
  sql - SQL query to execute a SqlRowSet representation (possibly a wrapper around ajavax.sql.rowset.CachedRowSet)
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForRowSet(String,Object[])
See Also:   SqlRowSetResultSetExtractor
See Also:   javax.sql.rowset.CachedRowSet




queryForRowSet
SqlRowSet queryForRowSet(String sql, Object[] args, int[] argTypes) throws DataAccessException(Code)
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 that, for the default implementation, JDBC RowSet support needs to be available at runtime: by default, Sun's com.sun.rowset.CachedRowSetImpl class is used, which is part of JDK 1.5+ and also available separately as part of Sun's JDBC RowSet Implementations download (rowset.jar).
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types) a SqlRowSet representation (possibly a wrapper around ajavax.sql.rowset.CachedRowSet)
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForRowSet(String)
See Also:   SqlRowSetResultSetExtractor
See Also:   javax.sql.rowset.CachedRowSet
See Also:   java.sql.Types




queryForRowSet
SqlRowSet queryForRowSet(String sql, Object[] args) throws DataAccessException(Code)
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 that, for the default implementation, JDBC RowSet support needs to be available at runtime: by default, Sun's com.sun.rowset.CachedRowSetImpl class is used, which is part of JDK 1.5+ and also available separately as part of Sun's JDBC RowSet Implementations download (rowset.jar).
Parameters:
  sql - SQL query to execute
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale a SqlRowSet representation (possibly a wrapper around ajavax.sql.rowset.CachedRowSet)
throws:
  DataAccessException - if there is any problem executing the query
See Also:   JdbcOperations.queryForRowSet(String)
See Also:   SqlRowSetResultSetExtractor
See Also:   javax.sql.rowset.CachedRowSet




update
int update(String sql) throws DataAccessException(Code)
Issue a single SQL update.
Parameters:
  sql - static SQL to execute the number of rows affected
throws:
  DataAccessException - if there is any problem.



update
int update(PreparedStatementCreator psc) throws DataAccessException(Code)
Issue an update using a PreparedStatementCreator to provide SQL and any required parameters.

A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.
Parameters:
  psc - object that provides SQL and any necessary parameters the number of rows affected
throws:
  DataAccessException - if there is any problem issuing the update
See Also:   PreparedStatementCreatorFactory




update
int update(PreparedStatementCreator psc, KeyHolder generatedKeyHolder) throws DataAccessException(Code)
Issue an update using a PreparedStatementCreator 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.
Parameters:
  psc - object that provides SQL and any necessary parameters
Parameters:
  generatedKeyHolder - KeyHolder that will hold the generated keys the number of rows affected
throws:
  DataAccessException - if there is any problem issuing the update
See Also:   PreparedStatementCreatorFactory
See Also:   org.springframework.jdbc.support.GeneratedKeyHolder




update
int update(String sql, PreparedStatementSetter pss) throws DataAccessException(Code)
Issue an update using a PreparedStatementSetter to set bind parameters, with given SQL. Simpler than using a PreparedStatementCreator as this method will create the PreparedStatement: The PreparedStatementSetter just needs to set parameters.
Parameters:
  sql - SQL containing bind parameters
Parameters:
  pss - helper that sets bind parameters. If this is nullwe run an update with static SQL. the number of rows affected
throws:
  DataAccessException - if there is any problem issuing the update



update
int update(String sql, Object[] args, int[] argTypes) throws DataAccessException(Code)
Issue an update via a prepared statement, binding the given arguments.
Parameters:
  sql - SQL containing bind parameters
Parameters:
  args - arguments to bind to the query
Parameters:
  argTypes - SQL types of the arguments(constants from java.sql.Types) the number of rows affected
throws:
  DataAccessException - if there is any problem issuing the update
See Also:   java.sql.Types



update
int update(String sql, Object[] args) throws DataAccessException(Code)
Issue an update via a prepared statement, binding the given arguments.
Parameters:
  sql - SQL containing bind parameters
Parameters:
  args - arguments to bind to the query(leaving it to the PreparedStatement to guess the corresponding SQL type);may also contain SqlParameterValue objects which indicate notonly the argument value but also the SQL type and optionally the scale the number of rows affected
throws:
  DataAccessException - if there is any problem issuing the update



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.