public class HeaJdbcTemplateImpl extends org.springframework.jdbc.support.JdbcAccessor implements IHeaJdbcTemplate
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, providing SQL and
any necessary parameters. The ResultSetExtractor interface extracts
values from a ResultSet. See also PreparedStatementSetter and
RowMapper for two popular alternative callback interfaces.
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.
Because this class is parameterizable by the callback interfaces and the
SQLExceptionTranslator interface,
there should be no need to subclass it.
All SQL operations performed by this class are logged at debug level, using "org.springframework.jdbc.core.JdbcTemplate" as log category.
NOTE: An instance of this class is thread-safe once configured.
PreparedStatementCreator,
PreparedStatementSetter,
CallableStatementCreator,
PreparedStatementCallback,
CallableStatementCallback,
ResultSetExtractor,
RowCallbackHandler,
RowMapper,
SQLExceptionTranslator| 构造器和说明 |
|---|
HeaJdbcTemplateImpl()
Construct a new JdbcTemplate for bean usage.
|
HeaJdbcTemplateImpl(DataSource dataSource)
Construct a new JdbcTemplate, given a DataSource to obtain connections
from.
|
HeaJdbcTemplateImpl(DataSource dataSource,
boolean lazyInit)
Construct a new JdbcTemplate, given a DataSource to obtain connections
from.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
applyStatementSettings(Statement stmt)
Prepare the given JDBC Statement (or PreparedStatement or
CallableStatement), applying statement settings such as fetch size, max
rows, and query timeout.
|
int[] |
batchUpdate(String... sql) |
int[] |
batchUpdate(String sql,
org.springframework.jdbc.core.BatchPreparedStatementSetter pss) |
<T> int[][] |
batchUpdate(String sql,
Collection<T> batchArgs,
int batchSize,
org.springframework.jdbc.core.ParameterizedPreparedStatementSetter<T> pss) |
Map<String,Object> |
call(org.springframework.jdbc.core.CallableStatementCreator csc,
List<org.springframework.jdbc.core.SqlParameter> declaredParameters) |
protected Connection |
createConnectionProxy(Connection con)
Create a close-suppressing proxy for the given JDBC Connection.
|
protected Map<String,Object> |
createResultsMap()
Create a Map instance to be used as results map.
|
<T> T |
execute(org.springframework.jdbc.core.CallableStatementCreator csc,
org.springframework.jdbc.core.CallableStatementCallback<T> action) |
<T> T |
execute(org.springframework.jdbc.core.ConnectionCallback<T> action) |
<T> T |
execute(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementCallback<T> action) |
<T> T |
execute(org.springframework.jdbc.core.StatementCallback<T> action) |
void |
execute(String sql) |
<T> T |
execute(String callString,
org.springframework.jdbc.core.CallableStatementCallback<T> action) |
<T> T |
execute(String sql,
org.springframework.jdbc.core.PreparedStatementCallback<T> action) |
protected Map<String,Object> |
extractOutputParameters(CallableStatement cs,
List<org.springframework.jdbc.core.SqlParameter> parameters)
Extract output parameters from the completed stored procedure.
|
protected Map<String,Object> |
extractReturnedResults(CallableStatement cs,
List<org.springframework.jdbc.core.SqlParameter> updateCountParameters,
List<org.springframework.jdbc.core.SqlParameter> resultSetParameters,
int updateCount)
Extract returned ResultSets from the completed stored procedure.
|
protected org.springframework.jdbc.core.RowMapper<Map<String,Object>> |
getColumnMapRowMapper()
Create a new RowMapper for reading columns as key-value pairs.
|
int |
getFetchSize()
Return the fetch size specified for this JdbcTemplate.
|
int |
getMaxRows()
Return the maximum number of rows specified for this JdbcTemplate.
|
org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor |
getNativeJdbcExtractor()
Return the current NativeJdbcExtractor implementation.
|
int |
getQueryTimeout()
Return the query timeout for statements that this JdbcTemplate executes.
|
protected <T> org.springframework.jdbc.core.RowMapper<T> |
getSingleColumnRowMapper(Class<T> requiredType)
Create a new RowMapper for reading result objects from a single column.
|
protected void |
handleWarnings(SQLWarning warning)
Throw an SQLWarningException if encountering an actual warning.
|
protected void |
handleWarnings(Statement stmt)
Throw an SQLWarningException if we're not ignoring warnings, else log the
warnings (at debug level).
|
protected <T> T |
insert(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.ResultSetExtractor<T> rse) |
<T> T |
insert(String sql,
org.springframework.jdbc.core.ResultSetExtractor<T> rse,
Object... params) |
boolean |
isIgnoreWarnings()
Return whether or not we ignore SQLWarnings.
|
boolean |
isResultsMapCaseInsensitive()
Return whether execution of a CallableStatement will return the results
in a Map that uses case insensitive names for the parameters.
|
boolean |
isSkipResultsProcessing()
Return whether results processing should be skipped.
|
boolean |
isSkipUndeclaredResults()
Return whether undeclared results should be skipped.
|
protected org.springframework.jdbc.core.PreparedStatementSetter |
newArgPreparedStatementSetter(Object[] args)
Create a new arg-based PreparedStatementSetter using the args passed in.
|
protected org.springframework.jdbc.core.PreparedStatementSetter |
newArgTypePreparedStatementSetter(Object[] args,
int[] argTypes)
Create a new arg-type-based PreparedStatementSetter using the args and
types passed in.
|
protected Map<String,Object> |
processResultSet(ResultSet rs,
org.springframework.jdbc.core.ResultSetSupportingSqlParameter param)
Process the given ResultSet from a stored procedure.
|
<T> T |
query(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.ResultSetExtractor<T> rse)
Query using a prepared statement, allowing for a PreparedStatementCreator
and a PreparedStatementSetter.
|
<T> T |
query(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.ResultSetExtractor<T> rse) |
void |
query(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.RowCallbackHandler rch) |
<T> List<T> |
query(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.RowMapper<T> rowMapper) |
<T> T |
query(String sql,
Object[] args,
int[] argTypes,
org.springframework.jdbc.core.ResultSetExtractor<T> rse) |
void |
query(String sql,
Object[] args,
int[] argTypes,
org.springframework.jdbc.core.RowCallbackHandler rch) |
<T> List<T> |
query(String sql,
Object[] args,
int[] argTypes,
org.springframework.jdbc.core.RowMapper<T> rowMapper) |
<T> T |
query(String sql,
Object[] args,
org.springframework.jdbc.core.ResultSetExtractor<T> rse) |
void |
query(String sql,
Object[] args,
org.springframework.jdbc.core.RowCallbackHandler rch) |
<T> List<T> |
query(String sql,
Object[] args,
org.springframework.jdbc.core.RowMapper<T> rowMapper) |
<T> T |
query(String sql,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.ResultSetExtractor<T> rse) |
void |
query(String sql,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.RowCallbackHandler rch) |
<T> List<T> |
query(String sql,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.RowMapper<T> rowMapper) |
<T> T |
query(String sql,
org.springframework.jdbc.core.ResultSetExtractor<T> rse) |
<T> T |
query(String sql,
org.springframework.jdbc.core.ResultSetExtractor<T> rse,
Object... args) |
void |
query(String sql,
org.springframework.jdbc.core.RowCallbackHandler rch) |
void |
query(String sql,
org.springframework.jdbc.core.RowCallbackHandler rch,
Object... args) |
<T> List<T> |
query(String sql,
org.springframework.jdbc.core.RowMapper<T> rowMapper) |
<T> List<T> |
query(String sql,
org.springframework.jdbc.core.RowMapper<T> rowMapper,
Object... args) |
List<Map<String,Object>> |
queryForList(String sql) |
<T> List<T> |
queryForList(String sql,
Class<T> elementType) |
<T> List<T> |
queryForList(String sql,
Class<T> elementType,
Object... args) |
List<Map<String,Object>> |
queryForList(String sql,
Object... args) |
<T> List<T> |
queryForList(String sql,
Object[] args,
Class<T> elementType) |
List<Map<String,Object>> |
queryForList(String sql,
Object[] args,
int[] argTypes) |
<T> List<T> |
queryForList(String sql,
Object[] args,
int[] argTypes,
Class<T> elementType) |
Map<String,Object> |
queryForMap(String sql) |
Map<String,Object> |
queryForMap(String sql,
Object... args) |
Map<String,Object> |
queryForMap(String sql,
Object[] args,
int[] argTypes) |
<T> T |
queryForObject(String sql,
Class<T> requiredType) |
<T> T |
queryForObject(String sql,
Class<T> requiredType,
Object... args) |
<T> T |
queryForObject(String sql,
Object[] args,
Class<T> requiredType) |
<T> T |
queryForObject(String sql,
Object[] args,
int[] argTypes,
Class<T> requiredType) |
<T> T |
queryForObject(String sql,
Object[] args,
int[] argTypes,
org.springframework.jdbc.core.RowMapper<T> rowMapper) |
<T> T |
queryForObject(String sql,
Object[] args,
org.springframework.jdbc.core.RowMapper<T> rowMapper) |
<T> T |
queryForObject(String sql,
org.springframework.jdbc.core.RowMapper<T> rowMapper) |
<T> T |
queryForObject(String sql,
org.springframework.jdbc.core.RowMapper<T> rowMapper,
Object... args) |
org.springframework.jdbc.support.rowset.SqlRowSet |
queryForRowSet(String sql) |
org.springframework.jdbc.support.rowset.SqlRowSet |
queryForRowSet(String sql,
Object... args) |
org.springframework.jdbc.support.rowset.SqlRowSet |
queryForRowSet(String sql,
Object[] args,
int[] argTypes) |
protected <T> T |
queryProc(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.ResultSetExtractor<T> rse) |
<T> T |
queryProc(String sql,
org.springframework.jdbc.core.ResultSetExtractor<T> rse,
Object... params) |
void |
setFetchSize(int fetchSize)
Set the fetch size for this JdbcTemplate.
|
void |
setIgnoreWarnings(boolean ignoreWarnings)
Set whether or not we want to ignore SQLWarnings.
|
void |
setMaxRows(int maxRows)
Set the maximum number of rows for this JdbcTemplate.
|
void |
setNativeJdbcExtractor(org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor extractor)
Set a NativeJdbcExtractor to extract native JDBC objects from wrapped
handles.
|
void |
setQueryTimeout(int queryTimeout)
Set the query timeout for statements that this JdbcTemplate executes.
|
void |
setResultsMapCaseInsensitive(boolean resultsMapCaseInsensitive)
Set whether execution of a CallableStatement will return the results in a
Map that uses case insensitive names for the parameters.
|
void |
setSkipResultsProcessing(boolean skipResultsProcessing)
Set whether results processing should be skipped.
|
void |
setSkipUndeclaredResults(boolean skipUndeclaredResults)
Set whether undeclared results should be skipped.
|
int |
update(org.springframework.jdbc.core.PreparedStatementCreator psc) |
int |
update(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.support.KeyHolder generatedKeyHolder) |
protected int |
update(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss) |
int |
update(String sql) |
int |
update(String sql,
Object... args) |
int |
update(String sql,
Object[] args,
int[] argTypes) |
int |
update(String sql,
org.springframework.jdbc.core.PreparedStatementSetter pss) |
public HeaJdbcTemplateImpl()
Note: The DataSource has to be set before using the instance.
JdbcAccessor.setDataSource(javax.sql.DataSource)public HeaJdbcTemplateImpl(DataSource dataSource)
Note: This will not trigger initialization of the exception translator.
dataSource - the JDBC DataSource to obtain connections frompublic HeaJdbcTemplateImpl(DataSource dataSource, boolean lazyInit)
Note: Depending on the "lazyInit" flag, initialization of the exception translator will be triggered.
dataSource - the JDBC DataSource to obtain connections fromlazyInit - whether to lazily initialize the SQLExceptionTranslatorpublic void setNativeJdbcExtractor(org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor extractor)
public org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor getNativeJdbcExtractor()
public void setIgnoreWarnings(boolean ignoreWarnings)
Default is "true", swallowing and logging all warnings. Switch this flag to "false" to make the JdbcTemplate throw a SQLWarningException instead.
SQLWarning,
SQLWarningException,
handleWarnings(java.sql.Statement)public boolean isIgnoreWarnings()
public void setFetchSize(int fetchSize)
Default is -1, indicating to use the JDBC driver's default (i.e. to not pass a specific fetch size setting on the driver).
public int getFetchSize()
public void setMaxRows(int maxRows)
Default is -1, indicating to use the JDBC driver's default (i.e. to not pass a specific max rows setting on the driver).
public int getMaxRows()
public void setQueryTimeout(int queryTimeout)
Default is -1, indicating to use the JDBC driver's default (i.e. to not pass a specific query timeout setting on the driver).
Note: Any timeout specified here will be overridden by the remaining transaction timeout when executing within a transaction that has a timeout specified at the transaction level.
public int getQueryTimeout()
public void setSkipResultsProcessing(boolean skipResultsProcessing)
public boolean isSkipResultsProcessing()
public void setSkipUndeclaredResults(boolean skipUndeclaredResults)
public boolean isSkipUndeclaredResults()
public void setResultsMapCaseInsensitive(boolean resultsMapCaseInsensitive)
public boolean isResultsMapCaseInsensitive()
public <T> T execute(org.springframework.jdbc.core.ConnectionCallback<T> action)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionprotected Connection createConnectionProxy(Connection con)
execute method.
The proxy also prepares returned JDBC Statements, applying statement settings such as fetch size, max rows, and query timeout.
con - the JDBC Connection to create a proxy forConnection.close(),
execute(ConnectionCallback),
applyStatementSettings(java.sql.Statement)public <T> T execute(org.springframework.jdbc.core.StatementCallback<T> action)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic void execute(String sql) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T query(String sql, org.springframework.jdbc.core.ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic void query(String sql, org.springframework.jdbc.core.RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> query(String sql, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic Map<String,Object> queryForMap(String sql) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryForObject(String sql, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryForObject(String sql, Class<T> requiredType) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> queryForList(String sql, Class<T> elementType) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic List<Map<String,Object>> queryForList(String sql) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic org.springframework.jdbc.support.rowset.SqlRowSet queryForRowSet(String sql) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic int update(String sql) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic int[] batchUpdate(String... sql) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T execute(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementCallback<T> action)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T execute(String sql, org.springframework.jdbc.core.PreparedStatementCallback<T> action) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T query(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.ResultSetExtractor<T> rse)
throws org.springframework.dao.DataAccessException
psc - Callback handler that can create a PreparedStatement given a
Connectionpss - 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.rse - object that will extract results.org.springframework.dao.DataAccessException - if there is any problempublic <T> T query(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.ResultSetExtractor<T> rse)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T query(String sql, org.springframework.jdbc.core.PreparedStatementSetter pss, org.springframework.jdbc.core.ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T query(String sql, Object[] args, int[] argTypes, org.springframework.jdbc.core.ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T query(String sql, Object[] args, org.springframework.jdbc.core.ResultSetExtractor<T> rse) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T query(String sql, org.springframework.jdbc.core.ResultSetExtractor<T> rse, Object... args) throws org.springframework.dao.DataAccessException
query 在接口中 IHeaJdbcTemplateorg.springframework.dao.DataAccessExceptionpublic void query(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.RowCallbackHandler rch)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic void query(String sql, org.springframework.jdbc.core.PreparedStatementSetter pss, org.springframework.jdbc.core.RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic void query(String sql, Object[] args, int[] argTypes, org.springframework.jdbc.core.RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic void query(String sql, Object[] args, org.springframework.jdbc.core.RowCallbackHandler rch) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic void query(String sql, org.springframework.jdbc.core.RowCallbackHandler rch, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> query(org.springframework.jdbc.core.PreparedStatementCreator psc, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> query(String sql, org.springframework.jdbc.core.PreparedStatementSetter pss, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> query(String sql, Object[] args, int[] argTypes, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> query(String sql, Object[] args, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> query(String sql, org.springframework.jdbc.core.RowMapper<T> rowMapper, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryForObject(String sql, Object[] args, int[] argTypes, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryForObject(String sql, Object[] args, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryForObject(String sql, org.springframework.jdbc.core.RowMapper<T> rowMapper, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> requiredType) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryForObject(String sql, Object[] args, Class<T> requiredType) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryForObject(String sql, Class<T> requiredType, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic Map<String,Object> queryForMap(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic Map<String,Object> queryForMap(String sql, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elementType) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> queryForList(String sql, Object[] args, Class<T> elementType) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> List<T> queryForList(String sql, Class<T> elementType, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic List<Map<String,Object>> queryForList(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic List<Map<String,Object>> queryForList(String sql, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic org.springframework.jdbc.support.rowset.SqlRowSet queryForRowSet(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic org.springframework.jdbc.support.rowset.SqlRowSet queryForRowSet(String sql, Object... args) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionprotected int update(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic int update(org.springframework.jdbc.core.PreparedStatementCreator psc)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic int update(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.support.KeyHolder generatedKeyHolder)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic int update(String sql, org.springframework.jdbc.core.PreparedStatementSetter pss) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic int update(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic int update(String sql, Object... args) throws org.springframework.dao.DataAccessException
update 在接口中 IHeaJdbcTemplateorg.springframework.dao.DataAccessExceptionpublic int[] batchUpdate(String sql, org.springframework.jdbc.core.BatchPreparedStatementSetter pss) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> int[][] batchUpdate(String sql, Collection<T> batchArgs, int batchSize, org.springframework.jdbc.core.ParameterizedPreparedStatementSetter<T> pss) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T execute(org.springframework.jdbc.core.CallableStatementCreator csc,
org.springframework.jdbc.core.CallableStatementCallback<T> action)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T execute(String callString, org.springframework.jdbc.core.CallableStatementCallback<T> action) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic Map<String,Object> call(org.springframework.jdbc.core.CallableStatementCreator csc, List<org.springframework.jdbc.core.SqlParameter> declaredParameters) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionprotected Map<String,Object> extractReturnedResults(CallableStatement cs, List<org.springframework.jdbc.core.SqlParameter> updateCountParameters, List<org.springframework.jdbc.core.SqlParameter> resultSetParameters, int updateCount) throws SQLException
cs - JDBC wrapper for the stored procedureupdateCountParameters - Parameter list of declared update count parameters for the
stored procedureresultSetParameters - Parameter list of declared resultSet parameters for the stored
procedureSQLExceptionprotected Map<String,Object> extractOutputParameters(CallableStatement cs, List<org.springframework.jdbc.core.SqlParameter> parameters) throws SQLException
cs - JDBC wrapper for the stored procedureparameters - parameter list for the stored procedureSQLExceptionprotected Map<String,Object> processResultSet(ResultSet rs, org.springframework.jdbc.core.ResultSetSupportingSqlParameter param) throws SQLException
rs - the ResultSet to processparam - the corresponding stored procedure parameterSQLExceptionprotected org.springframework.jdbc.core.RowMapper<Map<String,Object>> getColumnMapRowMapper()
ColumnMapRowMapperprotected <T> org.springframework.jdbc.core.RowMapper<T> getSingleColumnRowMapper(Class<T> requiredType)
requiredType - the type that each result object is expected to matchSingleColumnRowMapperprotected Map<String,Object> createResultsMap()
If "isResultsMapCaseInsensitive" has been set to true, a linked case-insensitive Map will be created.
setResultsMapCaseInsensitive(boolean)protected void applyStatementSettings(Statement stmt) throws SQLException
stmt - the JDBC Statement to prepareSQLException - if thrown by JDBC APIsetFetchSize(int),
setMaxRows(int),
setQueryTimeout(int),
DataSourceUtils.applyTransactionTimeout(java.sql.Statement, javax.sql.DataSource)protected org.springframework.jdbc.core.PreparedStatementSetter newArgPreparedStatementSetter(Object[] args)
By default, we'll create an ArgumentPreparedStatementSetter. This
method allows for the creation to be overridden by subclasses.
args - object array with argumentsprotected org.springframework.jdbc.core.PreparedStatementSetter newArgTypePreparedStatementSetter(Object[] args, int[] argTypes)
By default, we'll create an ArgumentTypePreparedStatementSetter.
This method allows for the creation to be overridden by subclasses.
args - object array with argumentsargTypes - int array of SQLTypes for the associated argumentsprotected void handleWarnings(Statement stmt) throws SQLException
stmt - the current JDBC statementorg.springframework.jdbc.SQLWarningException - if not ignoring warningsSQLExceptionSQLWarningExceptionprotected void handleWarnings(SQLWarning warning) throws org.springframework.jdbc.SQLWarningException
warning - the warnings object from the current statement. May be
null, in which case this method does nothing.org.springframework.jdbc.SQLWarningException - in case of an actual warning to be raisedprotected <T> T insert(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.ResultSetExtractor<T> rse)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T insert(String sql, org.springframework.jdbc.core.ResultSetExtractor<T> rse, Object... params)
insert 在接口中 IHeaJdbcTemplateprotected <T> T queryProc(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.ResultSetExtractor<T> rse)
throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessExceptionpublic <T> T queryProc(String sql, org.springframework.jdbc.core.ResultSetExtractor<T> rse, Object... params) throws SpringJdbcDataAccessException
queryProc 在接口中 IHeaJdbcTemplateSpringJdbcDataAccessExceptionCopyright © 2016. All rights reserved.