org.springframework.dao package.
Code using this class need only implement callback interfaces, giving them a clearly defined contract. The PreparedStatementCreator callback interface creates a prepared statement given a Connection provided by this class, providing SQL and any necessary parameters. The RowCallbackHandler interface extracts values from each row of a ResultSet.
Can be used within a service implementation via direct instantiation with a DataSource reference, or get prepared in an application context and given to services as bean reference. Note: The DataSource should always be configured as a bean in the application context, in the first case given to the service directly, in the second case to the prepared template.
The motivation and design of this class is discussed in detail in Expert One-On-One J2EE Design and Development by Rod Johnson (Wrox, 2002).
Because this class is parameterizable by the callback interfaces and the SQLExceptionTranslator interface, it isn't necessary to subclass it. All operations performed by this class are logged at debug level.
j
| Fields inherited from org.springframework.jdbc.supportJdbcAccessor |
|---|
| Constructor Summary |
|---|
|
Construct a new JdbcTemplate for bean usage. |
|
Construct a new JdbcTemplate, given a DataSource to obtain connections from. |
|
Construct a new JdbcTemplate, given a DataSource to obtain connections from. |
| Method Summary | |
|---|---|
| protected void |
Prepare the given JDBC Statement (or PreparedStatement or CallableStatement), applying statement settings such as fetch size, max rows, and query timeout. |
| int[] |
No description provided. |
| int[] |
No description provided. |
| Map |
No description provided. |
| protected Connection |
Create a close-suppressing proxy for the given JDBC Connection. |
| Object |
No description provided. |
| Object |
No description provided. |
| void |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| protected Map |
Extract output parameters from the completed stored procedure. |
| protected Map |
Extract returned ResultSets from the completed stored procedure. |
| protected RowMapper |
Create a new RowMapper for reading columns as key-value pairs. |
| int |
Return the fetch size specified for this JdbcTemplate. |
| int |
Return the maximum number of rows specified for this JdbcTemplate. |
| NativeJdbcExtractor |
Return the current NativeJdbcExtractor implementation. |
| protected RowMapper |
Create a new RowMapper for reading result objects from a single column. |
| boolean |
Return whether or not we ignore SQLWarnings. |
| protected Map |
Process the given ResultSet from a stored procedure. |
| Object |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| Object |
Query using a prepared statement, allowing for a PreparedStatementCreator and a PreparedStatementSetter. |
| Object |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| int |
No description provided. |
| int |
No description provided. |
| int |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| List |
No description provided. |
| long |
No description provided. |
| long |
No description provided. |
| long |
No description provided. |
| Map |
No description provided. |
| Map |
No description provided. |
| Map |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| Object |
No description provided. |
| SqlRowSet |
No description provided. |
| SqlRowSet |
No description provided. |
| SqlRowSet |
No description provided. |
| void |
Set the fetch size for this JdbcTemplate. |
| void |
Set whether or not we want to ignore SQLWarnings. |
| void |
Set the maximum number of rows for this JdbcTemplate. |
| void |
Set a NativeJdbcExtractor to extract native JDBC objects from wrapped handles. |
| int |
No description provided. |
| protected int |
No description provided. |
| int |
No description provided. |
| int |
No description provided. |
| int |
No description provided. |
| int |
No description provided. |
| int |
No description provided. |
| Methods inherited from org.springframework.beans.factoryInitializingBean |
|---|
| Methods inherited from org.springframework.jdbc.supportJdbcAccessor |
|---|
| Methods inherited from java.langObject |
|---|
public JdbcTemplate
(
)
execute method.
The proxy also prepares returned JDBC Statements, applying statement settings such as fetch size, max rows, and query timeout.
protected
Map
extractReturnedResultSets
(
CallableStatement
cs,
List
parameters,
int
updateCount
)
public
int
getFetchSize
(
)
public
int
getMaxRows
(
)
public
boolean
isIgnoreWarnings
(
)
public
Object
query
(
PreparedStatementCreator
psc,
PreparedStatementSetter
pss,
ResultSetExtractor
rse
)
public
Object
queryForObject
(
String
sql,
Object
[]
args,
int
[]
argTypes,
RowMapper
rowMapper
)
public
Object
queryForObject
(
String
sql,
Object
[]
args,
int
[]
argTypes,
Class
requiredType
)
public
void
setFetchSize
(
int
fetchSize
)
Default is 0, indicating to use the JDBC driver's default.
public
void
setIgnoreWarnings
(
boolean
ignoreWarnings
)
public
void
setMaxRows
(
int
maxRows
)
Default is 0, indicating to use the JDBC driver's default.