Replace <code> with {@code} throughout Javadoc
Issue: SPR-10128
This commit is contained in:
@@ -22,7 +22,7 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
|
||||
|
||||
/**
|
||||
* Exception thrown when SQL specified is invalid. Such exceptions always have
|
||||
* a <code>java.sql.SQLException</code> root cause.
|
||||
* a {@code java.sql.SQLException} root cause.
|
||||
*
|
||||
* <p>It would be possible to have subclasses for no such table, no such column etc.
|
||||
* A custom SQLExceptionTranslator could create such more specific exceptions,
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
|
||||
|
||||
/**
|
||||
* Exception thrown when a ResultSet has been accessed in an invalid fashion.
|
||||
* Such exceptions always have a <code>java.sql.SQLException</code> root cause.
|
||||
* Such exceptions always have a {@code java.sql.SQLException} root cause.
|
||||
*
|
||||
* <p>This typically happens when an invalid ResultSet column index or name
|
||||
* has been specified. Also thrown by disconnected SqlRowSets.
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* <p>Mapping is provided for fields in the target class for many common types, e.g.:
|
||||
* String, boolean, Boolean, byte, Byte, short, Short, int, Integer, long, Long,
|
||||
* float, Float, double, Double, BigDecimal, <code>java.util.Date</code>, etc.
|
||||
* float, Float, double, Double, BigDecimal, {@code java.util.Date}, etc.
|
||||
*
|
||||
* <p>To facilitate mapping between columns and fields that don't have matching names,
|
||||
* try using column aliases in the SQL statement like "select fname as first_name from customer".
|
||||
@@ -190,7 +190,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T> {
|
||||
/**
|
||||
* Set whether we're strictly validating that all bean properties have been
|
||||
* mapped from corresponding database fields.
|
||||
* <p>Default is <code>false</code>, accepting unpopulated properties in the
|
||||
* <p>Default is {@code false}, accepting unpopulated properties in the
|
||||
* target bean.
|
||||
*/
|
||||
public void setCheckFullyPopulated(boolean checkFullyPopulated) {
|
||||
@@ -208,7 +208,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T> {
|
||||
/**
|
||||
* Set whether we're defaulting Java primitives in the case of mapping a null value
|
||||
* from corresponding database fields.
|
||||
* <p>Default is <code>false</code>, throwing an exception when nulls are mapped to Java primitives.
|
||||
* <p>Default is {@code false}, throwing an exception when nulls are mapped to Java primitives.
|
||||
*/
|
||||
public void setPrimitivesDefaultedForNullValue(boolean primitivesDefaultedForNullValue) {
|
||||
this.primitivesDefaultedForNullValue = primitivesDefaultedForNullValue;
|
||||
@@ -295,11 +295,11 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T> {
|
||||
* <p>The default implementation calls
|
||||
* {@link JdbcUtils#getResultSetValue(java.sql.ResultSet, int, Class)}.
|
||||
* Subclasses may override this to check specific value types upfront,
|
||||
* or to post-process values return from <code>getResultSetValue</code>.
|
||||
* or to post-process values return from {@code getResultSetValue}.
|
||||
* @param rs is the ResultSet holding the data
|
||||
* @param index is the column index
|
||||
* @param pd the bean property that each result object is expected to match
|
||||
* (or <code>null</code> if none specified)
|
||||
* (or {@code null} if none specified)
|
||||
* @return the Object value
|
||||
* @throws SQLException in case of extraction failure
|
||||
* @see org.springframework.jdbc.support.JdbcUtils#getResultSetValue(java.sql.ResultSet, int, Class)
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.dao.DataAccessException;
|
||||
public interface CallableStatementCallback<T> {
|
||||
|
||||
/**
|
||||
* Gets called by <code>JdbcTemplate.execute</code> with an active JDBC
|
||||
* Gets called by {@code JdbcTemplate.execute} with an active JDBC
|
||||
* CallableStatement. Does not need to care about closing the Statement
|
||||
* or the Connection, or about handling transactions: this will all be
|
||||
* handled by Spring's JdbcTemplate.
|
||||
@@ -52,7 +52,7 @@ public interface CallableStatementCallback<T> {
|
||||
* within the callback implementation. Spring will close the Statement
|
||||
* object after the callback returned, but this does not necessarily imply
|
||||
* that the ResultSet resources will be closed: the Statement objects might
|
||||
* get pooled by the connection pool, with <code>close</code> calls only
|
||||
* get pooled by the connection pool, with {@code close} calls only
|
||||
* returning the object to the pool but not physically closing the resources.
|
||||
*
|
||||
* <p>If called without a thread-bound JDBC transaction (initiated by
|
||||
@@ -67,7 +67,7 @@ public interface CallableStatementCallback<T> {
|
||||
* the template.
|
||||
*
|
||||
* @param cs active JDBC CallableStatement
|
||||
* @return a result object, or <code>null</code> if none
|
||||
* @return a result object, or {@code null} if none
|
||||
* @throws SQLException if thrown by a JDBC method, to be auto-converted
|
||||
* into a DataAccessException by a SQLExceptionTranslator
|
||||
* @throws DataAccessException in case of custom exceptions
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CallableStatementCreatorFactory {
|
||||
/** The SQL call string, which won't change when the parameters change. */
|
||||
private final String callString;
|
||||
|
||||
/** List of SqlParameter objects. May not be <code>null</code>. */
|
||||
/** List of SqlParameter objects. May not be {@code null}. */
|
||||
private final List<SqlParameter> declaredParameters;
|
||||
|
||||
private int resultSetType = ResultSet.TYPE_FORWARD_ONLY;
|
||||
@@ -110,7 +110,7 @@ public class CallableStatementCreatorFactory {
|
||||
|
||||
/**
|
||||
* Return a new CallableStatementCreator instance given this parameters.
|
||||
* @param params list of parameters (may be <code>null</code>)
|
||||
* @param params list of parameters (may be {@code null})
|
||||
*/
|
||||
public CallableStatementCreator newCallableStatementCreator(Map<String, ?> params) {
|
||||
return new CallableStatementCreatorImpl(params != null ? params : new HashMap<String, Object>());
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.jdbc.support.JdbcUtils;
|
||||
import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
|
||||
/**
|
||||
* {@link RowMapper} implementation that creates a <code>java.util.Map</code>
|
||||
* {@link RowMapper} implementation that creates a {@code java.util.Map}
|
||||
* for each row, representing all columns as key-value pairs: one
|
||||
* entry for each column, with the column name as key.
|
||||
*
|
||||
@@ -83,7 +83,7 @@ public class ColumnMapRowMapper implements RowMapper<Map<String, Object>> {
|
||||
|
||||
/**
|
||||
* Retrieve a JDBC object value for the specified column.
|
||||
* <p>The default implementation uses the <code>getObject</code> method.
|
||||
* <p>The default implementation uses the {@code getObject} method.
|
||||
* Additionally, this implementation includes a "hack" to get around Oracle
|
||||
* returning a non standard object for their TIMESTAMP datatype.
|
||||
* @param rs is the ResultSet holding the data
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.dao.DataAccessException;
|
||||
* <p>This is particularly useful for delegating to existing data access code
|
||||
* that expects a Connection to work on and throws SQLException. For newly
|
||||
* written code, it is strongly recommended to use JdbcTemplate's more specific
|
||||
* operations, for example a <code>query</code> or <code>update</code> variant.
|
||||
* operations, for example a {@code query} or {@code update} variant.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.1.3
|
||||
@@ -40,7 +40,7 @@ import org.springframework.dao.DataAccessException;
|
||||
public interface ConnectionCallback<T> {
|
||||
|
||||
/**
|
||||
* Gets called by <code>JdbcTemplate.execute</code> with an active JDBC
|
||||
* Gets called by {@code JdbcTemplate.execute} with an active JDBC
|
||||
* Connection. Does not need to care about activating or closing the
|
||||
* Connection, or handling transactions.
|
||||
*
|
||||
@@ -52,12 +52,12 @@ public interface ConnectionCallback<T> {
|
||||
*
|
||||
* <p>Allows for returning a result object created within the callback, i.e.
|
||||
* a domain object or a collection of domain objects. Note that there's special
|
||||
* support for single step actions: see <code>JdbcTemplate.queryForObject</code>
|
||||
* support for single step actions: see {@code JdbcTemplate.queryForObject}
|
||||
* etc. A thrown RuntimeException is treated as application exception:
|
||||
* it gets propagated to the caller of the template.
|
||||
*
|
||||
* @param con active JDBC Connection
|
||||
* @return a result object, or <code>null</code> if none
|
||||
* @return a result object, or {@code null} if none
|
||||
* @throws SQLException if thrown by a JDBC method, to be auto-converted
|
||||
* to a DataAccessException by a SQLExceptionTranslator
|
||||
* @throws DataAccessException in case of custom exceptions
|
||||
|
||||
@@ -27,12 +27,12 @@ package org.springframework.jdbc.core;
|
||||
* <p>The {@link #isBatchExhausted} method is called after each call to
|
||||
* {@link #setValues} to determine whether there were some values added,
|
||||
* or if the batch was determined to be complete and no additional values
|
||||
* were provided during the last call to <code>setValues</code>.
|
||||
* were provided during the last call to {@code setValues}.
|
||||
*
|
||||
* <p>Consider extending the
|
||||
* {@link org.springframework.jdbc.core.support.AbstractInterruptibleBatchPreparedStatementSetter}
|
||||
* base class instead of implementing this interface directly, using a single
|
||||
* <code>setValuesIfAvailable</code> callback method that checks for available
|
||||
* {@code setValuesIfAvailable} callback method that checks for available
|
||||
* values and sets them, returning whether values have actually been provided.
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
@@ -45,12 +45,12 @@ public interface InterruptibleBatchPreparedStatementSetter extends BatchPrepared
|
||||
|
||||
/**
|
||||
* Return whether the batch is complete, that is, whether there were no
|
||||
* additional values added during the last <code>setValues</code> call.
|
||||
* <p><b>NOTE:</b> If this method returns <code>true</code>, any parameters
|
||||
* that might have been set during the last <code>setValues</code> call will
|
||||
* additional values added during the last {@code setValues} call.
|
||||
* <p><b>NOTE:</b> If this method returns {@code true}, any parameters
|
||||
* that might have been set during the last {@code setValues} call will
|
||||
* be ignored! Make sure that you set a corresponding internal flag if you
|
||||
* detect exhaustion <i>at the beginning</i> of your <code>setValues</code>
|
||||
* implementation, letting this method return <code>true</code> based on the flag.
|
||||
* detect exhaustion <i>at the beginning</i> of your {@code setValues}
|
||||
* implementation, letting this method return {@code true} based on the flag.
|
||||
* @param i index of the statement we're issuing in the batch, starting from 0
|
||||
* @return whether the batch is already exhausted
|
||||
* @see #setValues
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.springframework.jdbc.support.rowset.SqlRowSet;
|
||||
* 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
|
||||
* <code>org.springframework.test</code> package, shipped in
|
||||
* <code>spring-test.jar</code>.
|
||||
* {@code org.springframework.test} package, shipped in
|
||||
* {@code spring-test.jar}.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
@@ -56,7 +56,7 @@ public interface JdbcOperations {
|
||||
* <p>The callback action can return a result object, for example a
|
||||
* domain object or a collection of domain objects.
|
||||
* @param action the callback object that specifies the action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException if there is any problem
|
||||
*/
|
||||
<T> T execute(ConnectionCallback<T> action) throws DataAccessException;
|
||||
@@ -75,7 +75,7 @@ public interface JdbcOperations {
|
||||
* <p>The callback action can return a result object, for example a
|
||||
* domain object or a collection of domain objects.
|
||||
* @param action callback object that specifies the action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException if there is any problem
|
||||
*/
|
||||
<T> T execute(StatementCallback<T> action) throws DataAccessException;
|
||||
@@ -92,7 +92,7 @@ public interface JdbcOperations {
|
||||
* ResultSetExtractor.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>query</code> method with <code>null</code> as argument array.
|
||||
* {@code query} method with {@code null} as argument array.
|
||||
* @param sql SQL query to execute
|
||||
* @param rse object that will extract all rows of results
|
||||
* @return an arbitrary result object, as returned by the ResultSetExtractor
|
||||
@@ -106,7 +106,7 @@ public interface JdbcOperations {
|
||||
* basis with a RowCallbackHandler.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>query</code> method with <code>null</code> as argument array.
|
||||
* {@code query} method with {@code null} as argument array.
|
||||
* @param sql SQL query to execute
|
||||
* @param rch object that will extract results, one row at a time
|
||||
* @throws DataAccessException if there is any problem executing the query
|
||||
@@ -119,7 +119,7 @@ public interface JdbcOperations {
|
||||
* via a RowMapper.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>query</code> method with <code>null</code> as argument array.
|
||||
* {@code query} method with {@code null} as argument array.
|
||||
* @param sql SQL query to execute
|
||||
* @param rowMapper object that will map one object per row
|
||||
* @return the result List, containing mapped objects
|
||||
@@ -133,7 +133,7 @@ public interface JdbcOperations {
|
||||
* object via a RowMapper.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>queryForObject</code> method with <code>null</code> as argument array.
|
||||
* {@code queryForObject} method with {@code null} as argument array.
|
||||
* @param sql SQL query to execute
|
||||
* @param rowMapper object that will map one object per row
|
||||
* @return the single mapped object
|
||||
@@ -148,13 +148,13 @@ public interface JdbcOperations {
|
||||
* Execute a query for a result object, given static SQL.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>queryForObject</code> method with <code>null</code> as argument array.
|
||||
* {@code queryForObject} method with {@code null} as argument array.
|
||||
* <p>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.
|
||||
* @param sql SQL query to execute
|
||||
* @param requiredType the type that the result object is expected to match
|
||||
* @return the result object of the required type, or <code>null</code> in case of SQL NULL
|
||||
* @return the result object of the required type, or {@code null} in case of SQL NULL
|
||||
* @throws IncorrectResultSizeDataAccessException if the query does not return
|
||||
* exactly one row, or does not return exactly one column in that row
|
||||
* @throws DataAccessException if there is any problem executing the query
|
||||
@@ -166,7 +166,7 @@ public interface JdbcOperations {
|
||||
* Execute a query for a result Map, given static SQL.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>queryForMap</code> method with <code>null</code> as argument array.
|
||||
* {@code queryForMap} method with {@code null} as argument array.
|
||||
* <p>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).
|
||||
* @param sql SQL query to execute
|
||||
@@ -184,7 +184,7 @@ public interface JdbcOperations {
|
||||
* Execute a query that results in a long value, given static SQL.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>queryForLong</code> method with <code>null</code> as argument array.
|
||||
* {@code queryForLong} method with {@code null} as argument array.
|
||||
* <p>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.
|
||||
@@ -201,7 +201,7 @@ public interface JdbcOperations {
|
||||
* Execute a query that results in an int value, given static SQL.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>queryForInt</code> method with <code>null</code> as argument array.
|
||||
* {@code queryForInt} method with {@code null} as argument array.
|
||||
* <p>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.
|
||||
@@ -218,12 +218,12 @@ public interface JdbcOperations {
|
||||
* Execute a query for a result list, given static SQL.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>queryForList</code> method with <code>null</code> as argument array.
|
||||
* {@code queryForList} method with {@code null} as argument array.
|
||||
* <p>The results will be mapped to a List (one entry for each row) of
|
||||
* result objects, each of them matching the specified element type.
|
||||
* @param sql SQL query to execute
|
||||
* @param elementType the required type of element in the result list
|
||||
* (for example, <code>Integer.class</code>)
|
||||
* (for example, {@code Integer.class})
|
||||
* @return a List of objects that match the specified element type
|
||||
* @throws DataAccessException if there is any problem executing the query
|
||||
* @see #queryForList(String, Object[], Class)
|
||||
@@ -235,7 +235,7 @@ public interface JdbcOperations {
|
||||
* Execute a query for a result list, given static SQL.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>queryForList</code> method with <code>null</code> as argument array.
|
||||
* {@code queryForList} method with {@code null} as argument array.
|
||||
* <p>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
|
||||
@@ -251,16 +251,16 @@ public interface JdbcOperations {
|
||||
* Execute a query for a SqlRowSet, given static SQL.
|
||||
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
|
||||
* execute a static query with a PreparedStatement, use the overloaded
|
||||
* <code>queryForRowSet</code> method with <code>null</code> as argument array.
|
||||
* {@code queryForRowSet} method with {@code null} as argument array.
|
||||
* <p>The results will be mapped to an SqlRowSet which holds the data in a
|
||||
* disconnected fashion. This wrapper will translate any SQLExceptions thrown.
|
||||
* <p>Note that that, for the default implementation, JDBC RowSet support needs to
|
||||
* be available at runtime: by default, Sun's <code>com.sun.rowset.CachedRowSetImpl</code>
|
||||
* be available at runtime: by default, Sun's {@code 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).
|
||||
* @param sql SQL query to execute
|
||||
* @return a SqlRowSet representation (possibly a wrapper around a
|
||||
* <code>javax.sql.rowset.CachedRowSet</code>)
|
||||
* {@code javax.sql.rowset.CachedRowSet})
|
||||
* @throws DataAccessException if there is any problem executing the query
|
||||
* @see #queryForRowSet(String, Object[])
|
||||
* @see SqlRowSetResultSetExtractor
|
||||
@@ -301,7 +301,7 @@ public interface JdbcOperations {
|
||||
* domain object or a collection of domain objects.
|
||||
* @param psc object that can create a PreparedStatement given a Connection
|
||||
* @param action callback object that specifies the action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException if there is any problem
|
||||
*/
|
||||
<T> T execute(PreparedStatementCreator psc, PreparedStatementCallback<T> action)
|
||||
@@ -317,7 +317,7 @@ public interface JdbcOperations {
|
||||
* domain object or a collection of domain objects.
|
||||
* @param sql SQL to execute
|
||||
* @param action callback object that specifies the action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException if there is any problem
|
||||
*/
|
||||
<T> T execute(String sql, PreparedStatementCallback<T> action) throws DataAccessException;
|
||||
@@ -340,7 +340,7 @@ public interface JdbcOperations {
|
||||
* ResultSetExtractor.
|
||||
* @param sql SQL query to execute
|
||||
* @param pss object that knows how to set values on the prepared statement.
|
||||
* If this is <code>null</code>, the SQL will be assumed to contain no bind parameters.
|
||||
* If this is {@code null}, the SQL will be assumed to contain no bind parameters.
|
||||
* Even if there are no bind parameters, this object may be used to
|
||||
* set fetch size and other performance options.
|
||||
* @param rse object that will extract results
|
||||
@@ -357,7 +357,7 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @param rse object that will extract results
|
||||
* @return an arbitrary result object, as returned by the ResultSetExtractor
|
||||
* @throws DataAccessException if the query fails
|
||||
@@ -415,7 +415,7 @@ public interface JdbcOperations {
|
||||
* RowCallbackHandler.
|
||||
* @param sql SQL query to execute
|
||||
* @param pss object that knows how to set values on the prepared statement.
|
||||
* If this is <code>null</code>, the SQL will be assumed to contain no bind parameters.
|
||||
* If this is {@code null}, the SQL will be assumed to contain no bind parameters.
|
||||
* Even if there are no bind parameters, this object may be used to
|
||||
* set fetch size and other performance options.
|
||||
* @param rch object that will extract results, one row at a time
|
||||
@@ -431,7 +431,7 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @param rch object that will extract results, one row at a time
|
||||
* @throws DataAccessException if the query fails
|
||||
* @see java.sql.Types
|
||||
@@ -486,7 +486,7 @@ public interface JdbcOperations {
|
||||
* to the query, mapping each row to a Java object via a RowMapper.
|
||||
* @param sql SQL query to execute
|
||||
* @param pss object that knows how to set values on the prepared statement.
|
||||
* If this is <code>null</code>, the SQL will be assumed to contain no bind parameters.
|
||||
* If this is {@code null}, the SQL will be assumed to contain no bind parameters.
|
||||
* Even if there are no bind parameters, this object may be used to
|
||||
* set fetch size and other performance options.
|
||||
* @param rowMapper object that will map one object per row
|
||||
@@ -503,7 +503,7 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @param rowMapper object that will map one object per row
|
||||
* @return the result List, containing mapped objects
|
||||
* @throws DataAccessException if the query fails
|
||||
@@ -550,7 +550,7 @@ public interface JdbcOperations {
|
||||
* @param args arguments to bind to the query
|
||||
* (leaving it to the PreparedStatement to guess the corresponding SQL type)
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @param rowMapper object that will map one object per row
|
||||
* @return the single mapped object
|
||||
* @throws IncorrectResultSizeDataAccessException if the query does not
|
||||
@@ -604,9 +604,9 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @param requiredType the type that the result object is expected to match
|
||||
* @return the result object of the required type, or <code>null</code> in case of SQL NULL
|
||||
* @return the result object of the required type, or {@code null} in case of SQL NULL
|
||||
* @throws IncorrectResultSizeDataAccessException if the query does not return
|
||||
* exactly one row, or does not return exactly one column in that row
|
||||
* @throws DataAccessException if the query fails
|
||||
@@ -627,7 +627,7 @@ public interface JdbcOperations {
|
||||
* may also contain {@link SqlParameterValue} objects which indicate not
|
||||
* only the argument value but also the SQL type and optionally the scale
|
||||
* @param requiredType the type that the result object is expected to match
|
||||
* @return the result object of the required type, or <code>null</code> in case of SQL NULL
|
||||
* @return the result object of the required type, or {@code null} in case of SQL NULL
|
||||
* @throws IncorrectResultSizeDataAccessException if the query does not return
|
||||
* exactly one row, or does not return exactly one column in that row
|
||||
* @throws DataAccessException if the query fails
|
||||
@@ -646,7 +646,7 @@ public interface JdbcOperations {
|
||||
* (leaving it to the PreparedStatement to guess the corresponding SQL type);
|
||||
* may also contain {@link SqlParameterValue} objects which indicate not
|
||||
* only the argument value but also the SQL type and optionally the scale
|
||||
* @return the result object of the required type, or <code>null</code> in case of SQL NULL
|
||||
* @return the result object of the required type, or {@code null} in case of SQL NULL
|
||||
* @throws IncorrectResultSizeDataAccessException if the query does not return
|
||||
* exactly one row, or does not return exactly one column in that row
|
||||
* @throws DataAccessException if the query fails
|
||||
@@ -662,7 +662,7 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @return the result Map (one entry for each column, using the
|
||||
* column name as the key)
|
||||
* @throws IncorrectResultSizeDataAccessException if the query does not
|
||||
@@ -705,7 +705,7 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @return the long value, or 0 in case of SQL NULL
|
||||
* @throws IncorrectResultSizeDataAccessException if the query does not return
|
||||
* exactly one row, or does not return exactly one column in that row
|
||||
@@ -741,7 +741,7 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @return the int value, or 0 in case of SQL NULL
|
||||
* @throws IncorrectResultSizeDataAccessException if the query does not return
|
||||
* exactly one row, or does not return exactly one column in that row
|
||||
@@ -777,9 +777,9 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @param elementType the required type of element in the result list
|
||||
* (for example, <code>Integer.class</code>)
|
||||
* (for example, {@code Integer.class})
|
||||
* @return a List of objects that match the specified element type
|
||||
* @throws DataAccessException if the query fails
|
||||
* @see #queryForList(String, Class)
|
||||
@@ -799,7 +799,7 @@ public interface JdbcOperations {
|
||||
* may also contain {@link SqlParameterValue} objects which indicate not
|
||||
* only the argument value but also the SQL type and optionally the scale
|
||||
* @param elementType the required type of element in the result list
|
||||
* (for example, <code>Integer.class</code>)
|
||||
* (for example, {@code Integer.class})
|
||||
* @return a List of objects that match the specified element type
|
||||
* @throws DataAccessException if the query fails
|
||||
* @see #queryForList(String, Class)
|
||||
@@ -814,7 +814,7 @@ public interface JdbcOperations {
|
||||
* result objects, each of them matching the specified element type.
|
||||
* @param sql SQL query to execute
|
||||
* @param elementType the required type of element in the result list
|
||||
* (for example, <code>Integer.class</code>)
|
||||
* (for example, {@code Integer.class})
|
||||
* @param args arguments to bind to the query
|
||||
* (leaving it to the PreparedStatement to guess the corresponding SQL type);
|
||||
* may also contain {@link SqlParameterValue} objects which indicate not
|
||||
@@ -836,7 +836,7 @@ public interface JdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @return a List that contains a Map per row
|
||||
* @throws DataAccessException if the query fails
|
||||
* @see #queryForList(String)
|
||||
@@ -868,15 +868,15 @@ public interface JdbcOperations {
|
||||
* <p>The results will be mapped to an SqlRowSet which holds the data in a
|
||||
* disconnected fashion. This wrapper will translate any SQLExceptions thrown.
|
||||
* <p>Note that that, for the default implementation, JDBC RowSet support needs to
|
||||
* be available at runtime: by default, Sun's <code>com.sun.rowset.CachedRowSetImpl</code>
|
||||
* be available at runtime: by default, Sun's {@code 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).
|
||||
* @param sql SQL query to execute
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @return a SqlRowSet representation (possibly a wrapper around a
|
||||
* <code>javax.sql.rowset.CachedRowSet</code>)
|
||||
* {@code javax.sql.rowset.CachedRowSet})
|
||||
* @throws DataAccessException if there is any problem executing the query
|
||||
* @see #queryForRowSet(String)
|
||||
* @see SqlRowSetResultSetExtractor
|
||||
@@ -891,7 +891,7 @@ public interface JdbcOperations {
|
||||
* <p>The results will be mapped to an SqlRowSet which holds the data in a
|
||||
* disconnected fashion. This wrapper will translate any SQLExceptions thrown.
|
||||
* <p>Note that that, for the default implementation, JDBC RowSet support needs to
|
||||
* be available at runtime: by default, Sun's <code>com.sun.rowset.CachedRowSetImpl</code>
|
||||
* be available at runtime: by default, Sun's {@code 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).
|
||||
* @param sql SQL query to execute
|
||||
@@ -900,7 +900,7 @@ public interface JdbcOperations {
|
||||
* may also contain {@link SqlParameterValue} objects which indicate not
|
||||
* only the argument value but also the SQL type and optionally the scale
|
||||
* @return a SqlRowSet representation (possibly a wrapper around a
|
||||
* <code>javax.sql.rowset.CachedRowSet</code>)
|
||||
* {@code javax.sql.rowset.CachedRowSet})
|
||||
* @throws DataAccessException if there is any problem executing the query
|
||||
* @see #queryForRowSet(String)
|
||||
* @see SqlRowSetResultSetExtractor
|
||||
@@ -941,7 +941,7 @@ public interface JdbcOperations {
|
||||
* will create the PreparedStatement: The PreparedStatementSetter just needs to
|
||||
* set parameters.
|
||||
* @param sql SQL containing bind parameters
|
||||
* @param pss helper that sets bind parameters. If this is <code>null</code>
|
||||
* @param pss helper that sets bind parameters. If this is {@code null}
|
||||
* we run an update with static SQL.
|
||||
* @return the number of rows affected
|
||||
* @throws DataAccessException if there is any problem issuing the update
|
||||
@@ -954,7 +954,7 @@ public interface JdbcOperations {
|
||||
* @param sql SQL containing bind parameters
|
||||
* @param args arguments to bind to the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @return the number of rows affected
|
||||
* @throws DataAccessException if there is any problem issuing the update
|
||||
* @see java.sql.Types
|
||||
@@ -1001,7 +1001,7 @@ public interface JdbcOperations {
|
||||
* @param sql the SQL statement to execute.
|
||||
* @param batchArgs the List of Object arrays containing the batch of arguments for the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @return an array containing the numbers of rows affected by each update in the batch
|
||||
*/
|
||||
public int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes);
|
||||
@@ -1033,7 +1033,7 @@ public interface JdbcOperations {
|
||||
* domain object or a collection of domain objects.
|
||||
* @param csc object that can create a CallableStatement given a Connection
|
||||
* @param action callback object that specifies the action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException if there is any problem
|
||||
*/
|
||||
<T> T execute(CallableStatementCreator csc, CallableStatementCallback<T> action)
|
||||
@@ -1049,7 +1049,7 @@ public interface JdbcOperations {
|
||||
* domain object or a collection of domain objects.
|
||||
* @param callString the SQL call string to execute
|
||||
* @param action callback object that specifies the action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException if there is any problem
|
||||
*/
|
||||
<T> T execute(String callString, CallableStatementCallback<T> action) throws DataAccessException;
|
||||
|
||||
@@ -57,7 +57,7 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
* and extract results. This class executes SQL queries or updates, initiating
|
||||
* iteration over ResultSets and catching JDBC exceptions and translating
|
||||
* them to the generic, more informative exception hierarchy defined in the
|
||||
* <code>org.springframework.dao</code> package.
|
||||
* {@code org.springframework.dao} package.
|
||||
*
|
||||
* <p>Code using this class need only implement callback interfaces, giving
|
||||
* them a clearly defined contract. The {@link PreparedStatementCreator} callback
|
||||
@@ -135,7 +135,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
* If this variable is set to true then all results from a stored procedure call
|
||||
* that don't have a corresponding SqlOutParameter declaration will be bypassed.
|
||||
* All other results processing will be take place unless the variable
|
||||
* <code>skipResultsProcessing</code> is set to <code>true</code>.
|
||||
* {@code skipResultsProcessing} is set to {@code true}.
|
||||
*/
|
||||
private boolean skipUndeclaredResults = false;
|
||||
|
||||
@@ -355,7 +355,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
|
||||
/**
|
||||
* Create a close-suppressing proxy for the given JDBC Connection.
|
||||
* Called by the <code>execute</code> method.
|
||||
* Called by the {@code execute} method.
|
||||
* <p>The proxy also prepares returned JDBC Statements, applying
|
||||
* statement settings such as fetch size, max rows, and query timeout.
|
||||
* @param con the JDBC Connection to create a proxy for
|
||||
@@ -1331,7 +1331,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
/**
|
||||
* Throw an SQLWarningException if encountering an actual warning.
|
||||
* @param warning the warnings object from the current statement.
|
||||
* May be <code>null</code>, in which case this method does nothing.
|
||||
* May be {@code null}, in which case this method does nothing.
|
||||
* @throws SQLWarningException in case of an actual warning to be raised
|
||||
*/
|
||||
protected void handleWarnings(SQLWarning warning) throws SQLWarningException {
|
||||
@@ -1343,7 +1343,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
/**
|
||||
* Determine SQL from potential provider object.
|
||||
* @param sqlProvider object that's potentially a SqlProvider
|
||||
* @return the SQL string, or <code>null</code>
|
||||
* @return the SQL string, or {@code null}
|
||||
* @see SqlProvider
|
||||
*/
|
||||
private static String getSql(Object sqlProvider) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface ParameterMapper {
|
||||
* it is best to avoid using such proprietary RDBMS features if possible.
|
||||
* @throws SQLException if a SQLException is encountered setting
|
||||
* parameter values (that is, there's no need to catch SQLException)
|
||||
* @return Map of input parameters, keyed by name (never <code>null</code>)
|
||||
* @return Map of input parameters, keyed by name (never {@code null})
|
||||
*/
|
||||
Map<String, ?> createMap(Connection con) throws SQLException;
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.springframework.dao.DataAccessException;
|
||||
/**
|
||||
* Generic callback interface for code that operates on a PreparedStatement.
|
||||
* Allows to execute any number of operations on a single PreparedStatement,
|
||||
* for example a single <code>executeUpdate</code> call or repeated
|
||||
* <code>executeUpdate</code> calls with varying parameters.
|
||||
* for example a single {@code executeUpdate} call or repeated
|
||||
* {@code executeUpdate} calls with varying parameters.
|
||||
*
|
||||
* <p>Used internally by JdbcTemplate, but also useful for application code.
|
||||
* Note that the passed-in PreparedStatement can have been created by the
|
||||
@@ -43,7 +43,7 @@ import org.springframework.dao.DataAccessException;
|
||||
public interface PreparedStatementCallback<T> {
|
||||
|
||||
/**
|
||||
* Gets called by <code>JdbcTemplate.execute</code> with an active JDBC
|
||||
* Gets called by {@code JdbcTemplate.execute} with an active JDBC
|
||||
* PreparedStatement. Does not need to care about closing the Statement
|
||||
* or the Connection, or about handling transactions: this will all be
|
||||
* handled by Spring's JdbcTemplate.
|
||||
@@ -52,7 +52,7 @@ public interface PreparedStatementCallback<T> {
|
||||
* within the callback implementation. Spring will close the Statement
|
||||
* object after the callback returned, but this does not necessarily imply
|
||||
* that the ResultSet resources will be closed: the Statement objects might
|
||||
* get pooled by the connection pool, with <code>close</code> calls only
|
||||
* get pooled by the connection pool, with {@code close} calls only
|
||||
* returning the object to the pool but not physically closing the resources.
|
||||
*
|
||||
* <p>If called without a thread-bound JDBC transaction (initiated by
|
||||
@@ -68,7 +68,7 @@ public interface PreparedStatementCallback<T> {
|
||||
* propagated to the caller of the template.
|
||||
*
|
||||
* @param ps active JDBC PreparedStatement
|
||||
* @return a result object, or <code>null</code> if none
|
||||
* @return a result object, or {@code null} if none
|
||||
* @throws SQLException if thrown by a JDBC method, to be auto-converted
|
||||
* to a DataAccessException by a SQLExceptionTranslator
|
||||
* @throws DataAccessException in case of custom exceptions
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PreparedStatementCreatorFactory {
|
||||
/** The SQL, which won't change when the parameters change */
|
||||
private final String sql;
|
||||
|
||||
/** List of SqlParameter objects. May not be <code>null</code>. */
|
||||
/** List of SqlParameter objects. May not be {@code null}. */
|
||||
private final List<SqlParameter> declaredParameters;
|
||||
|
||||
private int resultSetType = ResultSet.TYPE_FORWARD_ONLY;
|
||||
@@ -144,7 +144,7 @@ public class PreparedStatementCreatorFactory {
|
||||
|
||||
/**
|
||||
* Return a new PreparedStatementSetter for the given parameters.
|
||||
* @param params list of parameters (may be <code>null</code>)
|
||||
* @param params list of parameters (may be {@code null})
|
||||
*/
|
||||
public PreparedStatementSetter newPreparedStatementSetter(List params) {
|
||||
return new PreparedStatementCreatorImpl(params != null ? params : Collections.emptyList());
|
||||
@@ -152,7 +152,7 @@ public class PreparedStatementCreatorFactory {
|
||||
|
||||
/**
|
||||
* Return a new PreparedStatementSetter for the given parameters.
|
||||
* @param params the parameter array (may be <code>null</code>)
|
||||
* @param params the parameter array (may be {@code null})
|
||||
*/
|
||||
public PreparedStatementSetter newPreparedStatementSetter(Object[] params) {
|
||||
return new PreparedStatementCreatorImpl(params != null ? Arrays.asList(params) : Collections.emptyList());
|
||||
@@ -160,7 +160,7 @@ public class PreparedStatementCreatorFactory {
|
||||
|
||||
/**
|
||||
* Return a new PreparedStatementCreator for the given parameters.
|
||||
* @param params list of parameters (may be <code>null</code>)
|
||||
* @param params list of parameters (may be {@code null})
|
||||
*/
|
||||
public PreparedStatementCreator newPreparedStatementCreator(List<?> params) {
|
||||
return new PreparedStatementCreatorImpl(params != null ? params : Collections.emptyList());
|
||||
@@ -168,7 +168,7 @@ public class PreparedStatementCreatorFactory {
|
||||
|
||||
/**
|
||||
* Return a new PreparedStatementCreator for the given parameters.
|
||||
* @param params the parameter array (may be <code>null</code>)
|
||||
* @param params the parameter array (may be {@code null})
|
||||
*/
|
||||
public PreparedStatementCreator newPreparedStatementCreator(Object[] params) {
|
||||
return new PreparedStatementCreatorImpl(params != null ? Arrays.asList(params) : Collections.emptyList());
|
||||
@@ -178,7 +178,7 @@ public class PreparedStatementCreatorFactory {
|
||||
* Return a new PreparedStatementCreator for the given parameters.
|
||||
* @param sqlToUse the actual SQL statement to use (if different from
|
||||
* the factory's, for example because of named parameter expanding)
|
||||
* @param params the parameter array (may be <code>null</code>)
|
||||
* @param params the parameter array (may be {@code null})
|
||||
*/
|
||||
public PreparedStatementCreator newPreparedStatementCreator(String sqlToUse, Object[] params) {
|
||||
return new PreparedStatementCreatorImpl(
|
||||
|
||||
@@ -52,7 +52,7 @@ public interface ResultSetExtractor<T> {
|
||||
* Implementations must implement this method to process the entire ResultSet.
|
||||
* @param rs ResultSet to extract data from. Implementations should
|
||||
* not close this: it will be closed by the calling JdbcTemplate.
|
||||
* @return an arbitrary result object, or <code>null</code> if none
|
||||
* @return an arbitrary result object, or {@code null} if none
|
||||
* (the extractor will typically be stateful in the latter case).
|
||||
* @throws SQLException if a SQLException is encountered getting column
|
||||
* values or navigating (that is, there's no need to catch SQLException)
|
||||
|
||||
@@ -127,7 +127,7 @@ public class ResultSetSupportingSqlParameter extends SqlParameter {
|
||||
|
||||
|
||||
/**
|
||||
* <p>This implementation always returns <code>false</code>.
|
||||
* <p>This implementation always returns {@code false}.
|
||||
*/
|
||||
@Override
|
||||
public boolean isInputValueProvided() {
|
||||
|
||||
@@ -46,7 +46,7 @@ public interface RowCallbackHandler {
|
||||
|
||||
/**
|
||||
* Implementations must implement this method to process each row of data
|
||||
* in the ResultSet. This method should not call <code>next()</code> on
|
||||
* in the ResultSet. This method should not call {@code next()} on
|
||||
* the ResultSet; it is only supposed to extract values of the current row.
|
||||
* <p>Exactly what the implementation chooses to do is up to it:
|
||||
* A trivial implementation might simply count rows, while another
|
||||
|
||||
@@ -66,7 +66,7 @@ public class RowCountCallbackHandler implements RowCallbackHandler {
|
||||
* Implementation of ResultSetCallbackHandler.
|
||||
* Work out column size if this is the first row, otherwise just count rows.
|
||||
* <p>Subclasses can perform custom extraction or processing
|
||||
* by overriding the <code>processRow(ResultSet, int)</code> method.
|
||||
* by overriding the {@code processRow(ResultSet, int)} method.
|
||||
* @see #processRow(java.sql.ResultSet, int)
|
||||
*/
|
||||
public final void processRow(ResultSet rs) throws SQLException {
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.sql.SQLException;
|
||||
*
|
||||
* <p>Alternatively, consider subclassing
|
||||
* {@link org.springframework.jdbc.object.MappingSqlQuery} from the
|
||||
* <code>jdbc.object</code> package: Instead of working with separate
|
||||
* {@code jdbc.object} package: Instead of working with separate
|
||||
* JdbcTemplate and RowMapper objects, you can build executable query
|
||||
* objects (containing row-mapping logic) in that style.
|
||||
*
|
||||
@@ -49,7 +49,7 @@ public interface RowMapper<T> {
|
||||
|
||||
/**
|
||||
* Implementations must implement this method to map each row of data
|
||||
* in the ResultSet. This method should not call <code>next()</code> on
|
||||
* in the ResultSet. This method should not call {@code next()} on
|
||||
* the ResultSet; it is only supposed to map values of the current row.
|
||||
* @param rs the ResultSet to map (pre-initialized for the current row)
|
||||
* @param rowNum the number of the current row
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.util.Assert;
|
||||
* "select * from user where id=?", new Object[] {id},
|
||||
* new RowMapperResultSetExtractor(rowMapper, 1));</pre>
|
||||
*
|
||||
* <p>Alternatively, consider subclassing MappingSqlQuery from the <code>jdbc.object</code>
|
||||
* <p>Alternatively, consider subclassing MappingSqlQuery from the {@code jdbc.object}
|
||||
* package: Instead of working with separate JdbcTemplate and RowMapper objects,
|
||||
* you can have executable query objects (containing row-mapping logic) there.
|
||||
*
|
||||
|
||||
@@ -27,11 +27,11 @@ import org.springframework.util.NumberUtils;
|
||||
|
||||
/**
|
||||
* {@link RowMapper} implementation that converts a single column into a single
|
||||
* result value per row. Expects to operate on a <code>java.sql.ResultSet</code>
|
||||
* result value per row. Expects to operate on a {@code java.sql.ResultSet}
|
||||
* that just contains a single column.
|
||||
*
|
||||
* <p>The type of the result value for each row can be specified. The value
|
||||
* for the single column will be extracted from the <code>ResultSet</code>
|
||||
* for the single column will be extracted from the {@code ResultSet}
|
||||
* and converted into the specified target type.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
@@ -72,8 +72,8 @@ public class SingleColumnRowMapper<T> implements RowMapper<T> {
|
||||
/**
|
||||
* Extract a value for the single column in the current row.
|
||||
* <p>Validates that there is only one column selected,
|
||||
* then delegates to <code>getColumnValue()</code> and also
|
||||
* <code>convertValueToRequiredType</code>, if necessary.
|
||||
* then delegates to {@code getColumnValue()} and also
|
||||
* {@code convertValueToRequiredType}, if necessary.
|
||||
* @see java.sql.ResultSetMetaData#getColumnCount()
|
||||
* @see #getColumnValue(java.sql.ResultSet, int, Class)
|
||||
* @see #convertValueToRequiredType(Object, Class)
|
||||
@@ -108,13 +108,13 @@ public class SingleColumnRowMapper<T> implements RowMapper<T> {
|
||||
* <p>The default implementation calls
|
||||
* {@link JdbcUtils#getResultSetValue(java.sql.ResultSet, int, Class)}.
|
||||
* If no required type has been specified, this method delegates to
|
||||
* <code>getColumnValue(rs, index)</code>, which basically calls
|
||||
* <code>ResultSet.getObject(index)</code> but applies some additional
|
||||
* {@code getColumnValue(rs, index)}, which basically calls
|
||||
* {@code ResultSet.getObject(index)} but applies some additional
|
||||
* default conversion to appropriate value types.
|
||||
* @param rs is the ResultSet holding the data
|
||||
* @param index is the column index
|
||||
* @param requiredType the type that each result object is expected to match
|
||||
* (or <code>null</code> if none specified)
|
||||
* (or {@code null} if none specified)
|
||||
* @return the Object value
|
||||
* @throws SQLException in case of extraction failure
|
||||
* @see org.springframework.jdbc.support.JdbcUtils#getResultSetValue(java.sql.ResultSet, int, Class)
|
||||
@@ -133,10 +133,10 @@ public class SingleColumnRowMapper<T> implements RowMapper<T> {
|
||||
/**
|
||||
* Retrieve a JDBC object value for the specified column, using the most
|
||||
* appropriate value type. Called if no required type has been specified.
|
||||
* <p>The default implementation delegates to <code>JdbcUtils.getResultSetValue()</code>,
|
||||
* which uses the <code>ResultSet.getObject(index)</code> method. Additionally,
|
||||
* <p>The default implementation delegates to {@code JdbcUtils.getResultSetValue()},
|
||||
* which uses the {@code ResultSet.getObject(index)} method. Additionally,
|
||||
* it includes a "hack" to get around Oracle returning a non-standard object for
|
||||
* their TIMESTAMP datatype. See the <code>JdbcUtils#getResultSetValue()</code>
|
||||
* their TIMESTAMP datatype. See the {@code JdbcUtils#getResultSetValue()}
|
||||
* javadoc for details.
|
||||
* @param rs is the ResultSet holding the data
|
||||
* @param index is the column index
|
||||
@@ -152,13 +152,13 @@ public class SingleColumnRowMapper<T> implements RowMapper<T> {
|
||||
* Convert the given column value to the specified required type.
|
||||
* Only called if the extracted column value does not match already.
|
||||
* <p>If the required type is String, the value will simply get stringified
|
||||
* via <code>toString()</code>. In case of a Number, the value will be
|
||||
* via {@code toString()}. In case of a Number, the value will be
|
||||
* converted into a Number, either through number conversion or through
|
||||
* String parsing (depending on the value type).
|
||||
* @param value the column value as extracted from <code>getColumnValue()</code>
|
||||
* (never <code>null</code>)
|
||||
* @param value the column value as extracted from {@code getColumnValue()}
|
||||
* (never {@code null})
|
||||
* @param requiredType the type that each result object is expected to match
|
||||
* (never <code>null</code>)
|
||||
* (never {@code null})
|
||||
* @return the converted value
|
||||
* @see #getColumnValue(java.sql.ResultSet, int, Class)
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.jdbc.core;
|
||||
|
||||
/**
|
||||
* Subclass of {@link SqlOutParameter} to represent an INOUT parameter.
|
||||
* Will return <code>true</code> for SqlParameter's {@link #isInputValueProvided}
|
||||
* Will return {@code true} for SqlParameter's {@link #isInputValueProvided}
|
||||
* test, in contrast to a standard SqlOutParameter.
|
||||
*
|
||||
* <p>Output parameters - like all stored procedure parameters -
|
||||
@@ -103,7 +103,7 @@ public class SqlInOutParameter extends SqlOutParameter {
|
||||
|
||||
|
||||
/**
|
||||
* This implementation always returns <code>true</code>.
|
||||
* This implementation always returns {@code true}.
|
||||
*/
|
||||
@Override
|
||||
public boolean isInputValueProvided() {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Object to represent a SQL parameter definition.
|
||||
*
|
||||
* <p>Parameters may be anonymous, in which case "name" is <code>null</code>.
|
||||
* <p>Parameters may be anonymous, in which case "name" is {@code null}.
|
||||
* However, all parameters must define a SQL type according to {@link java.sql.Types}.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
@@ -37,7 +37,7 @@ public class SqlParameter {
|
||||
/** The name of the parameter, if any */
|
||||
private String name;
|
||||
|
||||
/** SQL type constant from <code>java.sql.Types</code> */
|
||||
/** SQL type constant from {@code java.sql.Types} */
|
||||
private final int sqlType;
|
||||
|
||||
/** Used for types that are user-named like: STRUCT, DISTINCT, JAVA_OBJECT, named array types */
|
||||
@@ -50,7 +50,7 @@ public class SqlParameter {
|
||||
|
||||
/**
|
||||
* Create a new anonymous SqlParameter, supplying the SQL type.
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
*/
|
||||
public SqlParameter(int sqlType) {
|
||||
this.sqlType = sqlType;
|
||||
@@ -58,7 +58,7 @@ public class SqlParameter {
|
||||
|
||||
/**
|
||||
* Create a new anonymous SqlParameter, supplying the SQL type.
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
* @param typeName the type name of the parameter (optional)
|
||||
*/
|
||||
public SqlParameter(int sqlType, String typeName) {
|
||||
@@ -68,7 +68,7 @@ public class SqlParameter {
|
||||
|
||||
/**
|
||||
* Create a new anonymous SqlParameter, supplying the SQL type.
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
* @param scale the number of digits after the decimal point
|
||||
* (for DECIMAL and NUMERIC types)
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ public class SqlParameter {
|
||||
/**
|
||||
* Create a new SqlParameter, supplying name and SQL type.
|
||||
* @param name name of the parameter, as used in input and output maps
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
*/
|
||||
public SqlParameter(String name, int sqlType) {
|
||||
this.name = name;
|
||||
@@ -90,7 +90,7 @@ public class SqlParameter {
|
||||
/**
|
||||
* Create a new SqlParameter, supplying name and SQL type.
|
||||
* @param name name of the parameter, as used in input and output maps
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
* @param typeName the type name of the parameter (optional)
|
||||
*/
|
||||
public SqlParameter(String name, int sqlType, String typeName) {
|
||||
@@ -102,7 +102,7 @@ public class SqlParameter {
|
||||
/**
|
||||
* Create a new SqlParameter, supplying name and SQL type.
|
||||
* @param name name of the parameter, as used in input and output maps
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
* @param scale the number of digits after the decimal point
|
||||
* (for DECIMAL and NUMERIC types)
|
||||
*/
|
||||
@@ -156,8 +156,8 @@ public class SqlParameter {
|
||||
|
||||
/**
|
||||
* Return whether this parameter holds input values that should be set
|
||||
* before execution even if they are <code>null</code>.
|
||||
* <p>This implementation always returns <code>true</code>.
|
||||
* before execution even if they are {@code null}.
|
||||
* <p>This implementation always returns {@code true}.
|
||||
*/
|
||||
public boolean isInputValueProvided() {
|
||||
return true;
|
||||
@@ -166,7 +166,7 @@ public class SqlParameter {
|
||||
/**
|
||||
* Return whether this parameter is an implicit return parameter used during the
|
||||
* results preocessing of the CallableStatement.getMoreResults/getUpdateCount.
|
||||
* <p>This implementation always returns <code>false</code>.
|
||||
* <p>This implementation always returns {@code false}.
|
||||
*/
|
||||
public boolean isResultsParameter() {
|
||||
return false;
|
||||
@@ -174,7 +174,7 @@ public class SqlParameter {
|
||||
|
||||
|
||||
/**
|
||||
* Convert a list of JDBC types, as defined in <code>java.sql.Types</code>,
|
||||
* Convert a list of JDBC types, as defined in {@code java.sql.Types},
|
||||
* to a List of SqlParameter objects as used in this package.
|
||||
*/
|
||||
public static List<SqlParameter> sqlTypesToAnonymousParameterList(int[] types) {
|
||||
|
||||
@@ -21,7 +21,7 @@ package org.springframework.jdbc.core;
|
||||
* such as the SQL type and the scale for numeric values.
|
||||
*
|
||||
* <p>Designed for use with {@link JdbcTemplate}'s operations that take an array of
|
||||
* argument values: Each such argument value may be a <code>SqlParameterValue</code>,
|
||||
* argument values: Each such argument value may be a {@code SqlParameterValue},
|
||||
* indicating the SQL type (and optionally the scale) instead of letting the
|
||||
* template guess a default type. Note that this only applies to the operations with
|
||||
* a 'plain' argument array, not to the overloaded variants with an explicit type array.
|
||||
@@ -41,7 +41,7 @@ public class SqlParameterValue extends SqlParameter {
|
||||
|
||||
/**
|
||||
* Create a new SqlParameterValue, supplying the SQL type.
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
* @param value the value object
|
||||
*/
|
||||
public SqlParameterValue(int sqlType, Object value) {
|
||||
@@ -51,7 +51,7 @@ public class SqlParameterValue extends SqlParameter {
|
||||
|
||||
/**
|
||||
* Create a new SqlParameterValue, supplying the SQL type.
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
* @param typeName the type name of the parameter (optional)
|
||||
* @param value the value object
|
||||
*/
|
||||
@@ -62,7 +62,7 @@ public class SqlParameterValue extends SqlParameter {
|
||||
|
||||
/**
|
||||
* Create a new SqlParameterValue, supplying the SQL type.
|
||||
* @param sqlType SQL type of the parameter according to <code>java.sql.Types</code>
|
||||
* @param sqlType SQL type of the parameter according to {@code java.sql.Types}
|
||||
* @param scale the number of digits after the decimal point
|
||||
* (for DECIMAL and NUMERIC types)
|
||||
* @param value the value object
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface SqlProvider {
|
||||
/**
|
||||
* Return the SQL string for this object, i.e.
|
||||
* typically the SQL used for creating statements.
|
||||
* @return the SQL string, or <code>null</code>
|
||||
* @return the SQL string, or {@code null}
|
||||
*/
|
||||
String getSql();
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SqlReturnResultSet extends ResultSetSupportingSqlParameter {
|
||||
/**
|
||||
* Return whether this parameter is an implicit return parameter used during the
|
||||
* results preocessing of the CallableStatement.getMoreResults/getUpdateCount.
|
||||
* <p>This implementation always returns <code>true</code>.
|
||||
* <p>This implementation always returns {@code true}.
|
||||
*/
|
||||
@Override
|
||||
public boolean isResultsParameter() {
|
||||
|
||||
@@ -21,10 +21,10 @@ import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Interface to be implemented for retrieving values for more complex database-specific
|
||||
* types not supported by the standard <code>CallableStatement.getObject</code> method.
|
||||
* types not supported by the standard {@code CallableStatement.getObject} method.
|
||||
*
|
||||
* <p>Implementations perform the actual work of getting the actual values. They must
|
||||
* implement the callback method <code>getTypeValue</code> which can throw SQLExceptions
|
||||
* implement the callback method {@code getTypeValue} which can throw SQLExceptions
|
||||
* that will be caught and translated by the calling code. This callback method has
|
||||
* access to the underlying Connection via the given CallableStatement object, if that
|
||||
* should be needed to create any database-specific objects.
|
||||
|
||||
@@ -23,8 +23,8 @@ public class SqlReturnUpdateCount extends SqlParameter {
|
||||
|
||||
/**
|
||||
* Return whether this parameter holds input values that should be set
|
||||
* before execution even if they are <code>null</code>.
|
||||
* <p>This implementation always returns <code>false</code>.
|
||||
* before execution even if they are {@code null}.
|
||||
* <p>This implementation always returns {@code false}.
|
||||
*/
|
||||
@Override
|
||||
public boolean isInputValueProvided() {
|
||||
@@ -34,7 +34,7 @@ public class SqlReturnUpdateCount extends SqlParameter {
|
||||
/**
|
||||
* Return whether this parameter is an implicit return parameter used during the
|
||||
* results preocessing of the CallableStatement.getMoreResults/getUpdateCount.
|
||||
* <p>This implementation always returns <code>true</code>.
|
||||
* <p>This implementation always returns {@code true}.
|
||||
*/
|
||||
@Override
|
||||
public boolean isResultsParameter() {
|
||||
|
||||
@@ -32,8 +32,8 @@ import org.springframework.jdbc.support.rowset.SqlRowSet;
|
||||
*
|
||||
* <p>The default implementation uses a standard JDBC CachedRowSet underneath.
|
||||
* This means that JDBC RowSet support needs to be available at runtime:
|
||||
* by default, Sun's <code>com.sun.rowset.CachedRowSetImpl</code> class on Java 5 and 6,
|
||||
* or the <code>javax.sql.rowset.RowSetProvider</code> mechanism on Java 7 / JDBC 4.1.
|
||||
* by default, Sun's {@code com.sun.rowset.CachedRowSetImpl} class on Java 5 and 6,
|
||||
* or the {@code javax.sql.rowset.RowSetProvider} mechanism on Java 7 / JDBC 4.1.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2
|
||||
@@ -82,10 +82,10 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
|
||||
|
||||
/**
|
||||
* Create a new CachedRowSet instance, to be populated by
|
||||
* the <code>createSqlRowSet</code> implementation.
|
||||
* the {@code createSqlRowSet} implementation.
|
||||
* <p>The default implementation uses JDBC 4.1's RowSetProvider
|
||||
* when running on JDK 7 or higher, falling back to Sun's
|
||||
* <code>com.sun.rowset.CachedRowSetImpl</code> class on older JDKs.
|
||||
* {@code com.sun.rowset.CachedRowSetImpl} class on older JDKs.
|
||||
* @return a new CachedRowSet instance
|
||||
* @throws SQLException if thrown by JDBC methods
|
||||
* @see #createSqlRowSet
|
||||
|
||||
@@ -23,11 +23,11 @@ import org.springframework.jdbc.support.JdbcUtils;
|
||||
|
||||
/**
|
||||
* Interface to be implemented for setting values for more complex database-specific
|
||||
* types not supported by the standard <code>setObject</code> method. This is
|
||||
* types not supported by the standard {@code setObject} method. This is
|
||||
* effectively an extended variant of {@link org.springframework.jdbc.support.SqlValue}.
|
||||
*
|
||||
* <p>Implementations perform the actual work of setting the actual values. They must
|
||||
* implement the callback method <code>setTypeValue</code> which can throw SQLExceptions
|
||||
* implement the callback method {@code setTypeValue} which can throw SQLExceptions
|
||||
* that will be caught and translated by the calling code. This callback method has
|
||||
* access to the underlying Connection via the given PreparedStatement object, if that
|
||||
* should be needed to create any database-specific objects.
|
||||
@@ -44,7 +44,7 @@ public interface SqlTypeValue {
|
||||
|
||||
/**
|
||||
* Constant that indicates an unknown (or unspecified) SQL type.
|
||||
* Passed into <code>setTypeValue</code> if the original operation method
|
||||
* Passed into {@code setTypeValue} if the original operation method
|
||||
* does not specify a SQL type.
|
||||
* @see java.sql.Types
|
||||
* @see JdbcOperations#update(String, Object[])
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.springframework.dao.DataAccessException;
|
||||
/**
|
||||
* Generic callback interface for code that operates on a JDBC Statement.
|
||||
* Allows to execute any number of operations on a single Statement,
|
||||
* for example a single <code>executeUpdate</code> call or repeated
|
||||
* <code>executeUpdate</code> calls with varying SQL.
|
||||
* for example a single {@code executeUpdate} call or repeated
|
||||
* {@code executeUpdate} calls with varying SQL.
|
||||
*
|
||||
* <p>Used internally by JdbcTemplate, but also useful for application code.
|
||||
*
|
||||
@@ -36,7 +36,7 @@ import org.springframework.dao.DataAccessException;
|
||||
public interface StatementCallback<T> {
|
||||
|
||||
/**
|
||||
* Gets called by <code>JdbcTemplate.execute</code> with an active JDBC
|
||||
* Gets called by {@code JdbcTemplate.execute} with an active JDBC
|
||||
* Statement. Does not need to care about closing the Statement or the
|
||||
* Connection, or about handling transactions: this will all be handled
|
||||
* by Spring's JdbcTemplate.
|
||||
@@ -45,7 +45,7 @@ public interface StatementCallback<T> {
|
||||
* within the callback implementation. Spring will close the Statement
|
||||
* object after the callback returned, but this does not necessarily imply
|
||||
* that the ResultSet resources will be closed: the Statement objects might
|
||||
* get pooled by the connection pool, with <code>close</code> calls only
|
||||
* get pooled by the connection pool, with {@code close} calls only
|
||||
* returning the object to the pool but not physically closing the resources.
|
||||
*
|
||||
* <p>If called without a thread-bound JDBC transaction (initiated by
|
||||
@@ -61,7 +61,7 @@ public interface StatementCallback<T> {
|
||||
* propagated to the caller of the template.
|
||||
*
|
||||
* @param stmt active JDBC Statement
|
||||
* @return a result object, or <code>null</code> if none
|
||||
* @return a result object, or {@code null} if none
|
||||
* @throws SQLException if thrown by a JDBC method, to be auto-converted
|
||||
* to a DataAccessException by a SQLExceptionTranslator
|
||||
* @throws DataAccessException in case of custom exceptions
|
||||
|
||||
@@ -92,7 +92,7 @@ public abstract class StatementCreatorUtils {
|
||||
/**
|
||||
* Derive a default SQL type from the given Java type.
|
||||
* @param javaType the Java type to translate
|
||||
* @return the corresponding SQL type, or <code>null</code> if none found
|
||||
* @return the corresponding SQL type, or {@code null} if none found
|
||||
*/
|
||||
public static int javaTypeToSqlParameterType(Class javaType) {
|
||||
Integer sqlType = javaTypeToSqlTypeMap.get(javaType);
|
||||
@@ -367,7 +367,7 @@ public abstract class StatementCreatorUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the given value is a <code>java.util.Date</code>
|
||||
* Check whether the given value is a {@code java.util.Date}
|
||||
* (but not one of the JDBC-specific subclasses).
|
||||
*/
|
||||
private static boolean isDateValue(Class inValueType) {
|
||||
@@ -380,7 +380,7 @@ public abstract class StatementCreatorUtils {
|
||||
/**
|
||||
* Clean up all resources held by parameter values which were passed to an
|
||||
* execute method. This is for example important for closing LOB values.
|
||||
* @param paramValues parameter values supplied. May be <code>null</code>.
|
||||
* @param paramValues parameter values supplied. May be {@code null}.
|
||||
* @see DisposableSqlTypeValue#cleanup()
|
||||
* @see org.springframework.jdbc.core.support.SqlLobValue#cleanup()
|
||||
*/
|
||||
@@ -393,7 +393,7 @@ public abstract class StatementCreatorUtils {
|
||||
/**
|
||||
* Clean up all resources held by parameter values which were passed to an
|
||||
* execute method. This is for example important for closing LOB values.
|
||||
* @param paramValues parameter values supplied. May be <code>null</code>.
|
||||
* @param paramValues parameter values supplied. May be {@code null}.
|
||||
* @see DisposableSqlTypeValue#cleanup()
|
||||
* @see org.springframework.jdbc.core.support.SqlLobValue#cleanup()
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ public abstract class AbstractSqlParameterSource implements SqlParameterSource {
|
||||
* Return the SQL type for the given parameter, if registered.
|
||||
* @param paramName the name of the parameter
|
||||
* @return the SQL type of the parameter,
|
||||
* or <code>TYPE_UNKNOWN</code> if not registered
|
||||
* or {@code TYPE_UNKNOWN} if not registered
|
||||
*/
|
||||
public int getSqlType(String paramName) {
|
||||
Assert.notNull(paramName, "Parameter name must not be null");
|
||||
@@ -74,7 +74,7 @@ public abstract class AbstractSqlParameterSource implements SqlParameterSource {
|
||||
* Return the type name for the given parameter, if registered.
|
||||
* @param paramName the name of the parameter
|
||||
* @return the type name of the parameter,
|
||||
* or <code>null</code> if not registered
|
||||
* or {@code null} if not registered
|
||||
*/
|
||||
public String getTypeName(String paramName) {
|
||||
Assert.notNull(paramName, "Parameter name must not be null");
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
|
||||
* <p>This class is intended for passing in a simple Map of parameter values
|
||||
* to the methods of the {@link NamedParameterJdbcTemplate} class.
|
||||
*
|
||||
* <p>The <code>addValue</code> methods on this class will make adding several
|
||||
* <p>The {@code addValue} methods on this class will make adding several
|
||||
* values easier. The methods return a reference to the {@link MapSqlParameterSource}
|
||||
* itself, so you can chain several method calls together within a single statement.
|
||||
*
|
||||
@@ -48,7 +48,7 @@ public class MapSqlParameterSource extends AbstractSqlParameterSource {
|
||||
|
||||
/**
|
||||
* Create an empty MapSqlParameterSource,
|
||||
* with values to be added via <code>addValue</code>.
|
||||
* with values to be added via {@code addValue}.
|
||||
* @see #addValue(String, Object)
|
||||
*/
|
||||
public MapSqlParameterSource() {
|
||||
@@ -67,7 +67,7 @@ public class MapSqlParameterSource extends AbstractSqlParameterSource {
|
||||
|
||||
/**
|
||||
* Create a new MapSqlParameterSource based on a Map.
|
||||
* @param values a Map holding existing parameter values (can be <code>null</code>)
|
||||
* @param values a Map holding existing parameter values (can be {@code null})
|
||||
*/
|
||||
public MapSqlParameterSource(Map<String, ?> values) {
|
||||
addValues(values);
|
||||
@@ -124,7 +124,7 @@ public class MapSqlParameterSource extends AbstractSqlParameterSource {
|
||||
|
||||
/**
|
||||
* Add a Map of parameters to this parameter source.
|
||||
* @param values a Map holding existing parameter values (can be <code>null</code>)
|
||||
* @param values a Map holding existing parameter values (can be {@code null})
|
||||
* @return a reference to this parameter source,
|
||||
* so it's possible to chain several calls together
|
||||
*/
|
||||
|
||||
@@ -64,7 +64,7 @@ public interface NamedParameterJdbcOperations {
|
||||
* @param sql SQL to execute
|
||||
* @param paramSource container of arguments to bind to the query
|
||||
* @param action callback object that specifies the action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException if there is any problem
|
||||
*/
|
||||
<T> T execute(String sql, SqlParameterSource paramSource, PreparedStatementCallback<T> action)
|
||||
@@ -82,7 +82,7 @@ public interface NamedParameterJdbcOperations {
|
||||
* @param paramMap map of parameters to bind to the query
|
||||
* (leaving it to the PreparedStatement to guess the corresponding SQL type)
|
||||
* @param action callback object that specifies the action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException if there is any problem
|
||||
*/
|
||||
<T> T execute(String sql, Map<String, ?> paramMap, PreparedStatementCallback<T> action)
|
||||
@@ -207,7 +207,7 @@ public interface NamedParameterJdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param paramSource container of arguments to bind to the query
|
||||
* @param requiredType the type that the result object is expected to match
|
||||
* @return the result object of the required type, or <code>null</code> in case of SQL NULL
|
||||
* @return the result object of the required type, or {@code null} in case of SQL NULL
|
||||
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException
|
||||
* if the query does not return exactly one row, or does not return exactly
|
||||
* one column in that row
|
||||
@@ -226,7 +226,7 @@ public interface NamedParameterJdbcOperations {
|
||||
* @param paramMap map of parameters to bind to the query
|
||||
* (leaving it to the PreparedStatement to guess the corresponding SQL type)
|
||||
* @param requiredType the type that the result object is expected to match
|
||||
* @return the result object of the required type, or <code>null</code> in case of SQL NULL
|
||||
* @return the result object of the required type, or {@code null} in case of SQL NULL
|
||||
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException
|
||||
* if the query does not return exactly one row, or does not return exactly
|
||||
* one column in that row
|
||||
@@ -346,7 +346,7 @@ public interface NamedParameterJdbcOperations {
|
||||
* @param sql SQL query to execute
|
||||
* @param paramSource container of arguments to bind to the query
|
||||
* @param elementType the required type of element in the result list
|
||||
* (for example, <code>Integer.class</code>)
|
||||
* (for example, {@code Integer.class})
|
||||
* @return a List of objects that match the specified element type
|
||||
* @throws org.springframework.dao.DataAccessException if the query fails
|
||||
* @see org.springframework.jdbc.core.JdbcTemplate#queryForList(String, Class)
|
||||
@@ -364,7 +364,7 @@ public interface NamedParameterJdbcOperations {
|
||||
* @param paramMap map of parameters to bind to the query
|
||||
* (leaving it to the PreparedStatement to guess the corresponding SQL type)
|
||||
* @param elementType the required type of element in the result list
|
||||
* (for example, <code>Integer.class</code>)
|
||||
* (for example, {@code Integer.class})
|
||||
* @return a List of objects that match the specified element type
|
||||
* @throws org.springframework.dao.DataAccessException if the query fails
|
||||
* @see org.springframework.jdbc.core.JdbcTemplate#queryForList(String, Class)
|
||||
@@ -410,13 +410,13 @@ public interface NamedParameterJdbcOperations {
|
||||
* <p>The results will be mapped to an SqlRowSet which holds the data in a
|
||||
* disconnected fashion. This wrapper will translate any SQLExceptions thrown.
|
||||
* <p>Note that that, for the default implementation, JDBC RowSet support needs to
|
||||
* be available at runtime: by default, Sun's <code>com.sun.rowset.CachedRowSetImpl</code>
|
||||
* be available at runtime: by default, Sun's {@code 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).
|
||||
* @param sql SQL query to execute
|
||||
* @param paramSource container of arguments to bind to the query
|
||||
* @return a SqlRowSet representation (possibly a wrapper around a
|
||||
* <code>javax.sql.rowset.CachedRowSet</code>)
|
||||
* {@code javax.sql.rowset.CachedRowSet})
|
||||
* @throws org.springframework.dao.DataAccessException if there is any problem executing the query
|
||||
* @see org.springframework.jdbc.core.JdbcTemplate#queryForRowSet(String)
|
||||
* @see org.springframework.jdbc.core.SqlRowSetResultSetExtractor
|
||||
@@ -430,14 +430,14 @@ public interface NamedParameterJdbcOperations {
|
||||
* <p>The results will be mapped to an SqlRowSet which holds the data in a
|
||||
* disconnected fashion. This wrapper will translate any SQLExceptions thrown.
|
||||
* <p>Note that that, for the default implementation, JDBC RowSet support needs to
|
||||
* be available at runtime: by default, Sun's <code>com.sun.rowset.CachedRowSetImpl</code>
|
||||
* be available at runtime: by default, Sun's {@code 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).
|
||||
* @param sql SQL query to execute
|
||||
* @param paramMap map of parameters to bind to the query
|
||||
* (leaving it to the PreparedStatement to guess the corresponding SQL type)
|
||||
* @return a SqlRowSet representation (possibly a wrapper around a
|
||||
* <code>javax.sql.rowset.CachedRowSet</code>)
|
||||
* {@code javax.sql.rowset.CachedRowSet})
|
||||
* @throws org.springframework.dao.DataAccessException if there is any problem executing the query
|
||||
* @see org.springframework.jdbc.core.JdbcTemplate#queryForRowSet(String)
|
||||
* @see org.springframework.jdbc.core.SqlRowSetResultSetExtractor
|
||||
|
||||
@@ -305,7 +305,7 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
|
||||
|
||||
/**
|
||||
* Build a PreparedStatementCreator based on the given SQL and named parameters.
|
||||
* <p>Note: Not used for the <code>update</code> variant with generated key handling.
|
||||
* <p>Note: Not used for the {@code update} variant with generated key handling.
|
||||
* @param sql SQL to execute
|
||||
* @param paramSource container of arguments to bind
|
||||
* @return the corresponding PreparedStatementCreator
|
||||
|
||||
@@ -304,7 +304,7 @@ public abstract class NamedParameterUtils {
|
||||
* @param parsedSql the parsed SQL statement
|
||||
* @param paramSource the source for named parameters
|
||||
* @param declaredParams the List of declared SqlParameter objects
|
||||
* (may be <code>null</code>). If specified, the parameter metadata will
|
||||
* (may be {@code null}). If specified, the parameter metadata will
|
||||
* be built into the value array in the form of SqlParameterValue objects.
|
||||
* @return the array of values
|
||||
*/
|
||||
@@ -340,7 +340,7 @@ public abstract class NamedParameterUtils {
|
||||
* @param declaredParams the declared SqlParameter objects
|
||||
* @param paramName the name of the desired parameter
|
||||
* @param paramIndex the index of the desired parameter
|
||||
* @return the declared SqlParameter, or <code>null</code> if none found
|
||||
* @return the declared SqlParameter, or {@code null} if none found
|
||||
*/
|
||||
private static SqlParameter findParameter(List<SqlParameter> declaredParams, String paramName, int paramIndex) {
|
||||
if (declaredParams != null) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface SqlParameterSource {
|
||||
|
||||
/**
|
||||
* Constant that indicates an unknown (or unspecified) SQL type.
|
||||
* To be returned from <code>getType</code> when no specific SQL type known.
|
||||
* To be returned from {@code getType} when no specific SQL type known.
|
||||
* @see #getSqlType
|
||||
* @see java.sql.Types
|
||||
*/
|
||||
@@ -68,7 +68,7 @@ public interface SqlParameterSource {
|
||||
* Determine the SQL type for the specified named parameter.
|
||||
* @param paramName the name of the parameter
|
||||
* @return the SQL type of the specified parameter,
|
||||
* or <code>TYPE_UNKNOWN</code> if not known
|
||||
* or {@code TYPE_UNKNOWN} if not known
|
||||
* @see #TYPE_UNKNOWN
|
||||
*/
|
||||
int getSqlType(String paramName);
|
||||
@@ -77,7 +77,7 @@ public interface SqlParameterSource {
|
||||
* Determine the type name for the specified named parameter.
|
||||
* @param paramName the name of the parameter
|
||||
* @return the type name of the specified parameter,
|
||||
* or <code>null</code> if not known
|
||||
* or {@code null} if not known
|
||||
*/
|
||||
String getTypeName(String paramName);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.jdbc.core.SqlParameterValue;
|
||||
|
||||
/**
|
||||
* Class that provides helper methods for the use of {@link SqlParameterSource}
|
||||
* with <code>SimpleJdbc</code> classes.
|
||||
* with {@code SimpleJdbc} classes.
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @since 2.5
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* JdbcTemplate variant with named parameter support.
|
||||
@@ -9,7 +8,7 @@
|
||||
* NamedParameterJdbcOperations interface.
|
||||
*
|
||||
* <P>If you need the full power of Spring JDBC for less common operations, use
|
||||
* the <code>getJdbcOperations()</code> method of NamedParameterJdbcTemplate and
|
||||
* the {@code getJdbcOperations()} method of NamedParameterJdbcTemplate and
|
||||
* work with the returned classic template, or use a JdbcTemplate instance directly.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -197,10 +197,10 @@ public abstract class AbstractJdbcCall {
|
||||
|
||||
/**
|
||||
* Add a declared parameter to the list of parameters for the call.
|
||||
* Only parameters declared as <code>SqlParameter</code> and <code>SqlInOutParameter</code>
|
||||
* will be used to provide input values. This is different from the <code>StoredProcedure</code> class
|
||||
* Only parameters declared as {@code SqlParameter} and {@code SqlInOutParameter}
|
||||
* will be used to provide input values. This is different from the {@code StoredProcedure} class
|
||||
* which for backwards compatibility reasons allows input values to be provided for parameters declared
|
||||
* as <code>SqlOutParameter</code>.
|
||||
* as {@code SqlOutParameter}.
|
||||
* @param parameter the {@link SqlParameter} to add
|
||||
*/
|
||||
public void addDeclaredParameter(SqlParameter parameter) {
|
||||
@@ -326,7 +326,7 @@ public abstract class AbstractJdbcCall {
|
||||
/**
|
||||
* Check whether this operation has been compiled already;
|
||||
* lazily compile it if not already compiled.
|
||||
* <p>Automatically called by <code>doExecute</code>.
|
||||
* <p>Automatically called by {@code doExecute}.
|
||||
*/
|
||||
protected void checkCompiled() {
|
||||
if (!isCompiled()) {
|
||||
|
||||
@@ -308,7 +308,7 @@ public abstract class AbstractJdbcInsert {
|
||||
/**
|
||||
* Check whether this operation has been compiled already;
|
||||
* lazily compile it if not already compiled.
|
||||
* <p>Automatically called by <code>validateParameters</code>.
|
||||
* <p>Automatically called by {@code validateParameters}.
|
||||
*/
|
||||
protected void checkCompiled() {
|
||||
if (!isCompiled()) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
* and it must have a default or no-arg constructor.
|
||||
*
|
||||
* <p>Uses Java 5 covariant return types to override the return type of the {@link #mapRow}
|
||||
* method to be the type parameter <code>T</code>.
|
||||
* method to be the type parameter {@code T}.
|
||||
*
|
||||
* <p>Column values are mapped based on matching the column name as obtained from result set
|
||||
* metadata to public setters for the corresponding properties. The names are matched either
|
||||
@@ -33,7 +33,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
*
|
||||
* <p>Mapping is provided for fields in the target class for many common types, e.g.:
|
||||
* String, boolean, Boolean, byte, Byte, short, Short, int, Integer, long, Long,
|
||||
* float, Float, double, Double, BigDecimal, <code>java.util.Date</code>, etc.
|
||||
* float, Float, double, Double, BigDecimal, {@code java.util.Date}, etc.
|
||||
*
|
||||
* <p>The mapper can be configured to use the primitives default value when mapping null values
|
||||
* by setting the '{@link #setPrimitivesDefaultedForNullValue primitivesDefaultedForNullValue}'
|
||||
|
||||
@@ -21,14 +21,14 @@ import org.springframework.jdbc.core.SingleColumnRowMapper;
|
||||
/**
|
||||
* {@link ParameterizedRowMapper} implementation that converts a single column
|
||||
* into a single result value per row. Expects to operate on a
|
||||
* <code>java.sql.ResultSet</code> that just contains a single column.
|
||||
* {@code java.sql.ResultSet} that just contains a single column.
|
||||
*
|
||||
* <p>The type of the result value for each row can be specified. The value
|
||||
* for the single column will be extracted from the <code>ResultSet</code>
|
||||
* for the single column will be extracted from the {@code ResultSet}
|
||||
* and converted into the specified target type.
|
||||
*
|
||||
* <p>Uses Java 5 covariant return types to override the return type of the
|
||||
* {@link #mapRow} method to be the type parameter <code>T</code>.
|
||||
* {@link #mapRow} method to be the type parameter {@code T}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5.2
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SimpleJdbcCall extends AbstractJdbcCall implements SimpleJdbcCallOp
|
||||
/**
|
||||
* Constructor that takes one parameter with the JDBC DataSource to use when creating the
|
||||
* JdbcTemplate.
|
||||
* @param dataSource the <code>DataSource</code> to use
|
||||
* @param dataSource the {@code DataSource} to use
|
||||
* @see org.springframework.jdbc.core.JdbcTemplate#setDataSource
|
||||
*/
|
||||
public SimpleJdbcCall(DataSource dataSource) {
|
||||
@@ -71,7 +71,7 @@ public class SimpleJdbcCall extends AbstractJdbcCall implements SimpleJdbcCallOp
|
||||
|
||||
/**
|
||||
* Alternative Constructor that takes one parameter with the JdbcTemplate to be used.
|
||||
* @param jdbcTemplate the <code>JdbcTemplate</code> to use
|
||||
* @param jdbcTemplate the {@code JdbcTemplate} to use
|
||||
* @see org.springframework.jdbc.core.JdbcTemplate#setDataSource
|
||||
*/
|
||||
public SimpleJdbcCall(JdbcTemplate jdbcTemplate) {
|
||||
|
||||
@@ -71,10 +71,10 @@ public interface SimpleJdbcCallOperations {
|
||||
/**
|
||||
* Specify one or more parameters if desired. These parameters will be supplemented with any
|
||||
* parameter information retrieved from the database meta data.
|
||||
* Note that only parameters declared as <code>SqlParameter</code> and <code>SqlInOutParameter</code>
|
||||
* will be used to provide input values. This is different from the <code>StoredProcedure</code> class
|
||||
* Note that only parameters declared as {@code SqlParameter} and {@code SqlInOutParameter}
|
||||
* will be used to provide input values. This is different from the {@code StoredProcedure} class
|
||||
* which for backwards compatibility reasons allows input values to be provided for parameters declared
|
||||
* as <code>SqlOutParameter</code>.
|
||||
* as {@code SqlOutParameter}.
|
||||
* @param sqlParameters the parameters to use
|
||||
* @return the instance of this SimpleJdbcCall
|
||||
*/
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SimpleJdbcInsert extends AbstractJdbcInsert implements SimpleJdbcIn
|
||||
/**
|
||||
* Constructor that takes one parameter with the JDBC DataSource to use when creating the
|
||||
* JdbcTemplate.
|
||||
* @param dataSource the <code>DataSource</code> to use
|
||||
* @param dataSource the {@code DataSource} to use
|
||||
* @see org.springframework.jdbc.core.JdbcTemplate#setDataSource
|
||||
*/
|
||||
public SimpleJdbcInsert(DataSource dataSource) {
|
||||
@@ -62,7 +62,7 @@ public class SimpleJdbcInsert extends AbstractJdbcInsert implements SimpleJdbcIn
|
||||
|
||||
/**
|
||||
* Alternative Constructor that takes one parameter with the JdbcTemplate to be used.
|
||||
* @param jdbcTemplate the <code>JdbcTemplate</code> to use
|
||||
* @param jdbcTemplate the {@code JdbcTemplate} to use
|
||||
* @see org.springframework.jdbc.core.JdbcTemplate#setDataSource
|
||||
*/
|
||||
public SimpleJdbcInsert(JdbcTemplate jdbcTemplate) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface SimpleJdbcOperations {
|
||||
|
||||
|
||||
/**
|
||||
* Query for an <code>int</code> passing in a SQL query
|
||||
* Query for an {@code int} passing in a SQL query
|
||||
* using the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* and a map containing the arguments.
|
||||
@@ -68,17 +68,17 @@ public interface SimpleJdbcOperations {
|
||||
int queryForInt(String sql, Map<String, ?> args) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an <code>int</code> passing in a SQL query
|
||||
* Query for an {@code int} passing in a SQL query
|
||||
* using the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* and a <code>SqlParameterSource</code> containing the arguments.
|
||||
* and a {@code SqlParameterSource} containing the arguments.
|
||||
* @param sql the SQL query to run.
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query.
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query.
|
||||
*/
|
||||
int queryForInt(String sql, SqlParameterSource args) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an <code>int</code> passing in a SQL query
|
||||
* Query for an {@code int} passing in a SQL query
|
||||
* using the standard '?' placeholders for parameters
|
||||
* and a variable number of arguments.
|
||||
* @param sql the SQL query to run.
|
||||
@@ -87,7 +87,7 @@ public interface SimpleJdbcOperations {
|
||||
int queryForInt(String sql, Object... args) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an <code>long</code> passing in a SQL query
|
||||
* Query for an {@code long} passing in a SQL query
|
||||
* using the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* and a map containing the arguments.
|
||||
@@ -97,17 +97,17 @@ public interface SimpleJdbcOperations {
|
||||
long queryForLong(String sql, Map<String, ?> args) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an <code>long</code> passing in a SQL query
|
||||
* Query for an {@code long} passing in a SQL query
|
||||
* using the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* and a <code>SqlParameterSource</code> containing the arguments.
|
||||
* and a {@code SqlParameterSource} containing the arguments.
|
||||
* @param sql the SQL query to run.
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query
|
||||
*/
|
||||
long queryForLong(String sql, SqlParameterSource args) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an <code>long</code> passing in a SQL query
|
||||
* Query for an {@code long} passing in a SQL query
|
||||
* using the standard '?' placeholders for parameters
|
||||
* and a variable number of arguments.
|
||||
* @param sql the SQL query to run.
|
||||
@@ -116,7 +116,7 @@ public interface SimpleJdbcOperations {
|
||||
long queryForLong(String sql, Object... args) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> identified by the supplied @{@link Class}.
|
||||
* Query for an object of type {@code T} identified by the supplied @{@link Class}.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL query to run
|
||||
@@ -129,12 +129,12 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> identified by the supplied @{@link Class}.
|
||||
* Query for an object of type {@code T} identified by the supplied @{@link Class}.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL query to run
|
||||
* @param requiredType the required type of the return value
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query
|
||||
* @see JdbcOperations#queryForObject(String, Class)
|
||||
* @see JdbcOperations#queryForObject(String, Object[], Class)
|
||||
*/
|
||||
@@ -142,7 +142,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> identified by the supplied @{@link Class}.
|
||||
* Query for an object of type {@code T} identified by the supplied @{@link Class}.
|
||||
* Uses sql with the standard '?' placeholders for parameters
|
||||
* @param sql the SQL query to run
|
||||
* @param requiredType the required type of the return value
|
||||
@@ -154,7 +154,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> using the supplied
|
||||
* Query for an object of type {@code T} using the supplied
|
||||
* {@link RowMapper} to the query results to the object.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
@@ -168,7 +168,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> using the supplied
|
||||
* Query for an object of type {@code T} using the supplied
|
||||
* {@link ParameterizedRowMapper} to the query results to the object.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
@@ -185,13 +185,13 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> using the supplied
|
||||
* Query for an object of type {@code T} using the supplied
|
||||
* {@link RowMapper} to the query results to the object.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL query to run
|
||||
* @param rm the @{@link RowMapper} to use for result mapping
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query
|
||||
* @see JdbcOperations#queryForObject(String, org.springframework.jdbc.core.RowMapper)
|
||||
* @see JdbcOperations#queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
|
||||
*/
|
||||
@@ -199,13 +199,13 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> using the supplied
|
||||
* Query for an object of type {@code T} using the supplied
|
||||
* {@link ParameterizedRowMapper} to the query results to the object.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL query to run
|
||||
* @param rm the @{@link ParameterizedRowMapper} to use for result mapping
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query
|
||||
* @see JdbcOperations#queryForObject(String, org.springframework.jdbc.core.RowMapper)
|
||||
* @see JdbcOperations#queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
|
||||
* @deprecated as of Spring 3.0: Use the method using the newly genericized RowMapper interface
|
||||
@@ -216,7 +216,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> using the supplied
|
||||
* Query for an object of type {@code T} using the supplied
|
||||
* {@link RowMapper} to the query results to the object.
|
||||
* Uses sql with the standard '?' placeholders for parameters
|
||||
* @param sql the SQL query to run
|
||||
@@ -229,7 +229,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for an object of type <code>T</code> using the supplied
|
||||
* Query for an object of type {@code T} using the supplied
|
||||
* {@link ParameterizedRowMapper} to the query results to the object.
|
||||
* Uses sql with the standard '?' placeholders for parameters
|
||||
* @param sql the SQL query to run
|
||||
@@ -245,7 +245,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for a {@link List} of <code>Objects</code> of type <code>T</code> using
|
||||
* Query for a {@link List} of {@code Objects} of type {@code T} using
|
||||
* the supplied {@link RowMapper} to the query results to the object.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
@@ -259,7 +259,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for a {@link List} of <code>Objects</code> of type <code>T</code> using
|
||||
* Query for a {@link List} of {@code Objects} of type {@code T} using
|
||||
* the supplied {@link ParameterizedRowMapper} to the query results to the object.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
@@ -276,13 +276,13 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for a {@link List} of <code>Objects</code> of type <code>T</code> using
|
||||
* Query for a {@link List} of {@code Objects} of type {@code T} using
|
||||
* the supplied {@link RowMapper} to the query results to the object.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL query to run
|
||||
* @param rm the @{@link RowMapper} to use for result mapping
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query
|
||||
* @see JdbcOperations#queryForObject(String, org.springframework.jdbc.core.RowMapper)
|
||||
* @see JdbcOperations#queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
|
||||
*/
|
||||
@@ -290,13 +290,13 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for a {@link List} of <code>Objects</code> of type <code>T</code> using
|
||||
* Query for a {@link List} of {@code Objects} of type {@code T} using
|
||||
* the supplied {@link ParameterizedRowMapper} to the query results to the object.
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL query to run
|
||||
* @param rm the @{@link ParameterizedRowMapper} to use for result mapping
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query
|
||||
* @see JdbcOperations#queryForObject(String, org.springframework.jdbc.core.RowMapper)
|
||||
* @see JdbcOperations#queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
|
||||
* @deprecated as of Spring 3.0: Use the method using the newly genericized RowMapper interface
|
||||
@@ -307,7 +307,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for a {@link List} of <code>Objects</code> of type <code>T</code> using
|
||||
* Query for a {@link List} of {@code Objects} of type {@code T} using
|
||||
* the supplied {@link RowMapper} to the query results to the object.
|
||||
* Uses sql with the standard '?' placeholders for parameters
|
||||
* @param sql the SQL query to run
|
||||
@@ -320,7 +320,7 @@ public interface SimpleJdbcOperations {
|
||||
throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Query for a {@link List} of <code>Objects</code> of type <code>T</code> using
|
||||
* Query for a {@link List} of {@code Objects} of type {@code T} using
|
||||
* the supplied {@link ParameterizedRowMapper} to the query results to the object.
|
||||
* Uses sql with the standard '?' placeholders for parameters
|
||||
* @param sql the SQL query to run
|
||||
@@ -356,7 +356,7 @@ public interface SimpleJdbcOperations {
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL query to run
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query
|
||||
* @see JdbcOperations#queryForMap(String)
|
||||
* @see JdbcOperations#queryForMap(String, Object[])
|
||||
*/
|
||||
@@ -397,7 +397,7 @@ public interface SimpleJdbcOperations {
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL query to run
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the query
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the query
|
||||
* @see JdbcOperations#queryForList(String)
|
||||
* @see JdbcOperations#queryForList(String, Object[])
|
||||
*/
|
||||
@@ -433,7 +433,7 @@ public interface SimpleJdbcOperations {
|
||||
* Uses sql with the named parameter support provided by the
|
||||
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate}
|
||||
* @param sql the SQL statement to execute
|
||||
* @param args the <code>SqlParameterSource</code> containing the arguments for the statement
|
||||
* @param args the {@code SqlParameterSource} containing the arguments for the statement
|
||||
* @return the numbers of rows affected by the update
|
||||
* @see NamedParameterJdbcOperations#update(String, SqlParameterSource)
|
||||
*/
|
||||
@@ -483,7 +483,7 @@ public interface SimpleJdbcOperations {
|
||||
* @param sql the SQL statement to execute.
|
||||
* @param batchArgs the List of Object arrays containing the batch of arguments for the query
|
||||
* @param argTypes SQL types of the arguments
|
||||
* (constants from <code>java.sql.Types</code>)
|
||||
* (constants from {@code java.sql.Types})
|
||||
* @return an array containing the numbers of rows affected by each update in the batch
|
||||
*/
|
||||
public int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes);
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Simplification layer over JdbcTemplate for Java 5 and above.
|
||||
*
|
||||
* <p><code>SimpleJdbcInsert</code> and <code>SimpleJdbcCall</code> are classes that takes advantage
|
||||
* <p>{@code SimpleJdbcInsert} and {@code SimpleJdbcCall} are classes that takes advantage
|
||||
* of database metadata provided by the JDBC driver to simplify the application code. Much of the
|
||||
* parameter specification becomes unnecessary since it can be looked up in the metadata.
|
||||
*
|
||||
* Note: The <code>SimpleJdbcOperations</code> and <code>SimpleJdbcTemplate</code>, which provides a wrapper
|
||||
* Note: The {@code SimpleJdbcOperations} and {@code SimpleJdbcTemplate}, which provides a wrapper
|
||||
* around JdbcTemplate to take advantage of Java 5 features like generics, varargs and autoboxing, is now deprecated
|
||||
* since Spring 3.1. All functionality is now available in the <code>JdbcOperations</code> and
|
||||
* <code>NamedParametersOperations</code> respectively.
|
||||
* since Spring 3.1. All functionality is now available in the {@code JdbcOperations} and
|
||||
* {@code NamedParametersOperations} respectively.
|
||||
*
|
||||
*/
|
||||
package org.springframework.jdbc.core.simple;
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class AbstractInterruptibleBatchPreparedStatementSetter
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation returns <code>Integer.MAX_VALUE</code>.
|
||||
* This implementation returns {@code Integer.MAX_VALUE}.
|
||||
* Can be overridden in subclasses to lower the maximum batch size.
|
||||
*/
|
||||
public int getBatchSize() {
|
||||
@@ -62,7 +62,7 @@ public abstract class AbstractInterruptibleBatchPreparedStatementSetter
|
||||
|
||||
/**
|
||||
* Check for available values and set them on the given PreparedStatement.
|
||||
* If no values are available anymore, return <code>false</code>.
|
||||
* If no values are available anymore, return {@code false}.
|
||||
* @param ps PreparedStatement we'll invoke setter methods on
|
||||
* @param i index of the statement we're issuing in the batch, starting from 0
|
||||
* @return whether there were values to apply (that is, whether the applied
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.jdbc.support.lob.LobHandler;
|
||||
* Abstract PreparedStatementCallback implementation that manages a LobCreator.
|
||||
* Typically used as inner class, with access to surrounding method arguments.
|
||||
*
|
||||
* <p>Delegates to the <code>setValues</code> template method for setting values
|
||||
* <p>Delegates to the {@code setValues} template method for setting values
|
||||
* on the PreparedStatement, using a given LobCreator for BLOB/CLOB arguments.
|
||||
*
|
||||
* <p>A usage example with JdbcTemplate:
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.jdbc.core.ResultSetExtractor;
|
||||
* Abstract ResultSetExtractor implementation that assumes streaming of LOB data.
|
||||
* Typically used as inner class, with access to surrounding method arguments.
|
||||
*
|
||||
* <p>Delegates to the <code>streamData</code> template method for streaming LOB
|
||||
* <p>Delegates to the {@code streamData} template method for streaming LOB
|
||||
* content to some OutputStream, typically using a LobHandler. Converts an
|
||||
* IOException thrown during streaming to a LobRetrievalFailureException.
|
||||
*
|
||||
@@ -44,8 +44,8 @@ import org.springframework.jdbc.core.ResultSetExtractor;
|
||||
* new AbstractLobStreamingResultSetExtractor() {
|
||||
* public void streamData(ResultSet rs) throws SQLException, IOException {
|
||||
* FileCopyUtils.copy(lobHandler.getBlobAsBinaryStream(rs, 1), contentStream);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* );</pre>
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.jdbc.core.SqlTypeValue;
|
||||
/**
|
||||
* Abstract implementation of the SqlTypeValue interface, for convenient
|
||||
* creation of type values that are supposed to be passed into the
|
||||
* <code>PreparedStatement.setObject</code> method. The <code>createTypeValue</code>
|
||||
* {@code PreparedStatement.setObject} method. The {@code createTypeValue}
|
||||
* callback method has access to the underlying Connection, if that should
|
||||
* be needed to create any database-specific objects.
|
||||
*
|
||||
@@ -65,7 +65,7 @@ public abstract class AbstractSqlTypeValue implements SqlTypeValue {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the type value to be passed into <code>PreparedStatement.setObject</code>.
|
||||
* Create the type value to be passed into {@code PreparedStatement.setObject}.
|
||||
* @param con the JDBC Connection, if needed to create any database-specific objects
|
||||
* @param sqlType SQL type of the parameter we are setting
|
||||
* @param typeName the type name of the parameter
|
||||
|
||||
@@ -99,7 +99,7 @@ public class JdbcBeanDefinitionReader {
|
||||
* @param sql SQL query to use for loading bean definitions.
|
||||
* The first three columns must be bean name, property name and value.
|
||||
* Any join and any other columns are permitted: e.g.
|
||||
* <code>SELECT BEAN_NAME, PROPERTY, VALUE FROM CONFIG WHERE CONFIG.APP_ID = 1</code>
|
||||
* {@code SELECT BEAN_NAME, PROPERTY, VALUE FROM CONFIG WHERE CONFIG.APP_ID = 1}
|
||||
* It's also possible to perform a join. Column names are not significant --
|
||||
* only the ordering of these first three columns.
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.jdbc.support.SQLExceptionTranslator;
|
||||
*
|
||||
* <p>This base class is mainly intended for JdbcTemplate usage but can
|
||||
* also be used when working with a Connection directly or when using
|
||||
* <code>org.springframework.jdbc.object</code> operation objects.
|
||||
* {@code org.springframework.jdbc.object} operation objects.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 28.07.2003
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Classes supporting the <code>org.springframework.jdbc.core</code> package.
|
||||
* Classes supporting the {@code org.springframework.jdbc.core} package.
|
||||
* Contains a DAO base class for JdbcTemplate usage.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
* implementations, taking care of the padding.
|
||||
*
|
||||
* <p>'Padding' in the context of this class means default implementations
|
||||
* for certain methods from the <code>DataSource</code> interface, such as
|
||||
* for certain methods from the {@code DataSource} interface, such as
|
||||
* {@link #getLoginTimeout()}, {@link #setLoginTimeout(int)}, and so forth.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -109,7 +109,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
|
||||
|
||||
|
||||
/**
|
||||
* This implementation delegates to <code>getConnectionFromDriver</code>,
|
||||
* This implementation delegates to {@code getConnectionFromDriver},
|
||||
* using the default username and password of this DataSource.
|
||||
* @see #getConnectionFromDriver(String, String)
|
||||
* @see #setUsername
|
||||
@@ -120,7 +120,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation delegates to <code>getConnectionFromDriver</code>,
|
||||
* This implementation delegates to {@code getConnectionFromDriver},
|
||||
* using the given username and password.
|
||||
* @see #getConnectionFromDriver(String, String)
|
||||
*/
|
||||
|
||||
@@ -121,8 +121,8 @@ public class ConnectionHolder extends ResourceHolderSupport {
|
||||
|
||||
/**
|
||||
* Override the existing Connection handle with the given Connection.
|
||||
* Reset the handle if given <code>null</code>.
|
||||
* <p>Used for releasing the Connection on suspend (with a <code>null</code>
|
||||
* Reset the handle if given {@code null}.
|
||||
* <p>Used for releasing the Connection on suspend (with a {@code null}
|
||||
* argument) and setting a fresh Connection on resume.
|
||||
*/
|
||||
protected void setConnection(Connection connection) {
|
||||
@@ -140,7 +140,7 @@ public class ConnectionHolder extends ResourceHolderSupport {
|
||||
|
||||
/**
|
||||
* Return the current Connection held by this ConnectionHolder.
|
||||
* <p>This will be the same Connection until <code>released</code>
|
||||
* <p>This will be the same Connection until {@code released}
|
||||
* gets called on the ConnectionHolder, which will reset the
|
||||
* held Connection, fetching a new Connection on demand.
|
||||
* @see ConnectionHandle#getConnection()
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface ConnectionProxy extends Connection {
|
||||
* Return the target Connection of this proxy.
|
||||
* <p>This will typically be the native driver Connection
|
||||
* or a wrapper from a connection pool.
|
||||
* @return the underlying Connection (never <code>null</code>)
|
||||
* @return the underlying Connection (never {@code null})
|
||||
*/
|
||||
Connection getTargetConnection();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* {@link org.springframework.transaction.PlatformTransactionManager}
|
||||
* implementation for a single JDBC {@link javax.sql.DataSource}. This class is
|
||||
* capable of working in any environment with any JDBC driver, as long as the setup
|
||||
* uses a JDBC 2.0 Standard Extensions / JDBC 3.0 <code>javax.sql.DataSource</code>
|
||||
* uses a JDBC 2.0 Standard Extensions / JDBC 3.0 {@code javax.sql.DataSource}
|
||||
* as its Connection factory mechanism. Binds a JDBC Connection from the specified
|
||||
* DataSource to the current thread, potentially allowing for one thread-bound
|
||||
* Connection per DataSource.
|
||||
|
||||
@@ -234,7 +234,7 @@ public abstract class DataSourceUtils {
|
||||
* bound to the current thread by Spring's transaction facilities.
|
||||
* @param con the Connection to check
|
||||
* @param dataSource the DataSource that the Connection was obtained from
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @return whether the Connection is transactional
|
||||
*/
|
||||
public static boolean isConnectionTransactional(Connection con, DataSource dataSource) {
|
||||
@@ -284,9 +284,9 @@ public abstract class DataSourceUtils {
|
||||
* Close the given Connection, obtained from the given DataSource,
|
||||
* if it is not managed externally (that is, not bound to the thread).
|
||||
* @param con the Connection to close if necessary
|
||||
* (if this is <code>null</code>, the call will be ignored)
|
||||
* (if this is {@code null}, the call will be ignored)
|
||||
* @param dataSource the DataSource that the Connection was obtained from
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @see #getConnection
|
||||
*/
|
||||
public static void releaseConnection(Connection con, DataSource dataSource) {
|
||||
@@ -306,9 +306,9 @@ public abstract class DataSourceUtils {
|
||||
* Same as {@link #releaseConnection}, but throwing the original SQLException.
|
||||
* <p>Directly accessed by {@link TransactionAwareDataSourceProxy}.
|
||||
* @param con the Connection to close if necessary
|
||||
* (if this is <code>null</code>, the call will be ignored)
|
||||
* (if this is {@code null}, the call will be ignored)
|
||||
* @param dataSource the DataSource that the Connection was obtained from
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @throws SQLException if thrown by JDBC methods
|
||||
* @see #doGetConnection
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.util.ClassUtils;
|
||||
/**
|
||||
* Simple implementation of the standard JDBC {@link javax.sql.DataSource} interface,
|
||||
* configuring the plain old JDBC {@link java.sql.DriverManager} via bean properties, and
|
||||
* returning a new {@link java.sql.Connection} from every <code>getConnection</code> call.
|
||||
* returning a new {@link java.sql.Connection} from every {@code getConnection} call.
|
||||
*
|
||||
* <p><b>NOTE: This class is not an actual connection pool; it does not actually
|
||||
* pool Connections.</b> It just serves as simple replacement for a full-blown
|
||||
@@ -36,7 +36,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* <p>Useful for test or standalone environments outside of a J2EE container, either
|
||||
* as a DataSource bean in a corresponding ApplicationContext or in conjunction with
|
||||
* a simple JNDI environment. Pool-assuming <code>Connection.close()</code> calls will
|
||||
* a simple JNDI environment. Pool-assuming {@code Connection.close()} calls will
|
||||
* simply close the Connection, so any DataSource-aware persistence code should work.
|
||||
*
|
||||
* <p><b>NOTE: Within special class loading environments such as OSGi, this class
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
/**
|
||||
* An adapter for a target {@link javax.sql.DataSource}, applying the current
|
||||
* Spring transaction's isolation level (and potentially specified user credentials)
|
||||
* to every <code>getConnection</code> call. Also applies the read-only flag,
|
||||
* to every {@code getConnection} call. Also applies the read-only flag,
|
||||
* if specified.
|
||||
*
|
||||
* <p>Can be used to proxy a target JNDI DataSource that does not have the
|
||||
@@ -109,7 +109,7 @@ public class IsolationLevelDataSourceAdapter extends UserCredentialsDataSourceAd
|
||||
|
||||
/**
|
||||
* Return the statically specified isolation level,
|
||||
* or <code>null</code> if none.
|
||||
* or {@code null} if none.
|
||||
*/
|
||||
protected Integer getIsolationLevel() {
|
||||
return this.isolationLevel;
|
||||
@@ -139,7 +139,7 @@ public class IsolationLevelDataSourceAdapter extends UserCredentialsDataSourceAd
|
||||
/**
|
||||
* Determine the current isolation level: either the transaction's
|
||||
* isolation level or a statically defined isolation level.
|
||||
* @return the current isolation level, or <code>null</code> if none
|
||||
* @return the current isolation level, or {@code null} if none
|
||||
* @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionIsolationLevel()
|
||||
* @see #setIsolationLevel
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Simple implementation of the standard JDBC {@link javax.sql.DataSource} interface,
|
||||
* configuring a plain old JDBC {@link java.sql.Driver} via bean properties, and returning
|
||||
* a new {@link java.sql.Connection} from every <code>getConnection</code> call.
|
||||
* a new {@link java.sql.Connection} from every {@code getConnection} call.
|
||||
*
|
||||
* <p><b>NOTE: This class is not an actual connection pool; it does not actually
|
||||
* pool Connections.</b> It just serves as simple replacement for a full-blown
|
||||
|
||||
@@ -32,15 +32,15 @@ import org.springframework.util.ObjectUtils;
|
||||
* which is not closed after use. Obviously, this is not multi-threading capable.
|
||||
*
|
||||
* <p>Note that at shutdown, someone should close the underlying Connection
|
||||
* via the <code>close()</code> method. Client code will never call close
|
||||
* via the {@code close()} method. Client code will never call close
|
||||
* on the Connection handle if it is SmartDataSource-aware (e.g. uses
|
||||
* <code>DataSourceUtils.releaseConnection</code>).
|
||||
* {@code DataSourceUtils.releaseConnection}).
|
||||
*
|
||||
* <p>If client code will call <code>close()</code> in the assumption of a pooled
|
||||
* <p>If client code will call {@code close()} in the assumption of a pooled
|
||||
* Connection, like when using persistence tools, set "suppressClose" to "true".
|
||||
* This will return a close-suppressing proxy instead of the physical Connection.
|
||||
* Be aware that you will not be able to cast this to a native
|
||||
* <code>OracleConnection</code> or the like anymore; you need to use a
|
||||
* {@code OracleConnection} or the like anymore; you need to use a
|
||||
* {@link org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor} then.
|
||||
*
|
||||
* <p>This is primarily intended for testing. For example, it enables easy testing
|
||||
@@ -134,7 +134,7 @@ public class SingleConnectionDataSource extends DriverManagerDataSource
|
||||
* Create a new SingleConnectionDataSource with a given Connection.
|
||||
* @param target underlying target Connection
|
||||
* @param suppressClose if the Connection should be wrapped with a Connection that
|
||||
* suppresses <code>close()</code> calls (to allow for normal <code>close()</code>
|
||||
* suppresses {@code close()} calls (to allow for normal {@code close()}
|
||||
* usage in applications that expect a pooled Connection but do not know our
|
||||
* SmartDataSource interface)
|
||||
*/
|
||||
@@ -171,7 +171,7 @@ public class SingleConnectionDataSource extends DriverManagerDataSource
|
||||
|
||||
/**
|
||||
* Return whether the returned Connection's "autoCommit" setting should be overridden.
|
||||
* @return the "autoCommit" value, or <code>null</code> if none to be applied
|
||||
* @return the "autoCommit" value, or {@code null} if none to be applied
|
||||
*/
|
||||
protected Boolean getAutoCommitValue() {
|
||||
return this.autoCommit;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.sql.Connection;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* Extension of the <code>javax.sql.DataSource</code> interface, to be
|
||||
* Extension of the {@code javax.sql.DataSource} interface, to be
|
||||
* implemented by special DataSources that return JDBC Connections
|
||||
* in an unwrapped fashion.
|
||||
*
|
||||
@@ -40,7 +40,7 @@ public interface SmartDataSource extends DataSource {
|
||||
/**
|
||||
* Should we close this Connection, obtained from this DataSource?
|
||||
* <p>Code that uses Connections from a SmartDataSource should always
|
||||
* perform a check via this method before invoking <code>close()</code>.
|
||||
* perform a check via this method before invoking {@code close()}.
|
||||
* <p>Note that the JdbcTemplate class in the 'jdbc.core' package takes care of
|
||||
* releasing JDBC Connections, freeing application code of this responsibility.
|
||||
* @param con the Connection to check
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* <p>Delegates to {@link DataSourceUtils} for automatically participating in
|
||||
* thread-bound transactions, for example managed by {@link DataSourceTransactionManager}.
|
||||
* <code>getConnection</code> calls and <code>close</code> calls on returned Connections
|
||||
* {@code getConnection} calls and {@code close} calls on returned Connections
|
||||
* will behave properly within a transaction, i.e. always operate on the transactional
|
||||
* Connection. If not within a transaction, normal DataSource behavior applies.
|
||||
*
|
||||
@@ -129,7 +129,7 @@ public class TransactionAwareDataSourceProxy extends DelegatingDataSource {
|
||||
|
||||
/**
|
||||
* Wraps the given Connection with a proxy that delegates every method call to it
|
||||
* but delegates <code>close()</code> calls to DataSourceUtils.
|
||||
* but delegates {@code close()} calls to DataSourceUtils.
|
||||
* @param targetDataSource DataSource that the Connection came from
|
||||
* @return the wrapped Connection
|
||||
* @see java.sql.Connection#close()
|
||||
@@ -145,7 +145,7 @@ public class TransactionAwareDataSourceProxy extends DelegatingDataSource {
|
||||
/**
|
||||
* Determine whether to obtain a fixed target Connection for the proxy
|
||||
* or to reobtain the target Connection for each operation.
|
||||
* <p>The default implementation returns <code>true</code> for all
|
||||
* <p>The default implementation returns {@code true} for all
|
||||
* standard cases. This can be overridden through the
|
||||
* {@link #setReobtainTransactionalConnections "reobtainTransactionalConnections"}
|
||||
* flag, which enforces a non-fixed target Connection within an active transaction.
|
||||
|
||||
@@ -25,14 +25,14 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* An adapter for a target JDBC {@link javax.sql.DataSource}, applying the specified
|
||||
* user credentials to every standard <code>getConnection()</code> call, implicitly
|
||||
* invoking <code>getConnection(username, password)</code> on the target.
|
||||
* user credentials to every standard {@code getConnection()} call, implicitly
|
||||
* invoking {@code getConnection(username, password)} on the target.
|
||||
* All other methods simply delegate to the corresponding methods of the
|
||||
* target DataSource.
|
||||
*
|
||||
* <p>Can be used to proxy a target JNDI DataSource that does not have user
|
||||
* credentials configured. Client code can work with this DataSource as usual,
|
||||
* using the standard <code>getConnection()</code> call.
|
||||
* using the standard {@code getConnection()} call.
|
||||
*
|
||||
* <p>In the following example, client code can simply transparently work with
|
||||
* the preconfigured "myDataSource", implicitly accessing "myTargetDataSource"
|
||||
@@ -50,7 +50,7 @@ import org.springframework.util.StringUtils;
|
||||
* </bean></pre>
|
||||
*
|
||||
* <p>If the "username" is empty, this proxy will simply delegate to the
|
||||
* standard <code>getConnection()</code> method of the target DataSource.
|
||||
* standard {@code getConnection()} method of the target DataSource.
|
||||
* This can be used to keep a UserCredentialsDataSourceAdapter bean definition
|
||||
* just for the <i>option</i> of implicitly passing in user credentials if
|
||||
* the particular target DataSource requires it.
|
||||
@@ -97,7 +97,7 @@ public class UserCredentialsDataSourceAdapter extends DelegatingDataSource {
|
||||
/**
|
||||
* Set user credententials for this proxy and the current thread.
|
||||
* The given username and password will be applied to all subsequent
|
||||
* <code>getConnection()</code> calls on this DataSource proxy.
|
||||
* {@code getConnection()} calls on this DataSource proxy.
|
||||
* <p>This will override any statically specified user credentials,
|
||||
* that is, values of the "username" and "password" bean properties.
|
||||
* @param username the username to apply
|
||||
@@ -146,10 +146,10 @@ public class UserCredentialsDataSourceAdapter extends DelegatingDataSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation delegates to the <code>getConnection(username, password)</code>
|
||||
* This implementation delegates to the {@code getConnection(username, password)}
|
||||
* method of the target DataSource, passing in the specified user credentials.
|
||||
* If the specified username is empty, it will simply delegate to the standard
|
||||
* <code>getConnection()</code> method of the target DataSource.
|
||||
* {@code getConnection()} method of the target DataSource.
|
||||
* @param username the username to use
|
||||
* @param password the password to use
|
||||
* @return the Connection
|
||||
|
||||
@@ -125,7 +125,7 @@ public class WebSphereDataSourceAdapter extends IsolationLevelDataSourceAdapter
|
||||
|
||||
/**
|
||||
* Builds a WebSphere JDBCConnectionSpec object for the current settings
|
||||
* and calls <code>WSDataSource.getConnection(JDBCConnectionSpec)</code>.
|
||||
* and calls {@code WSDataSource.getConnection(JDBCConnectionSpec)}.
|
||||
* @see #createConnectionSpec
|
||||
* @see com.ibm.websphere.rsadapter.WSDataSource#getConnection(com.ibm.websphere.rsadapter.JDBCConnectionSpec)
|
||||
*/
|
||||
@@ -144,15 +144,15 @@ public class WebSphereDataSourceAdapter extends IsolationLevelDataSourceAdapter
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a WebSphere <code>JDBCConnectionSpec</code> object for the given charateristics.
|
||||
* Create a WebSphere {@code JDBCConnectionSpec} object for the given charateristics.
|
||||
* <p>The default implementation uses reflection to apply the given settings.
|
||||
* Can be overridden in subclasses to customize the JDBCConnectionSpec object
|
||||
* (<a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/rsadapter/JDBCConnectionSpec.html">JDBCConnectionSpec javadoc</a>;
|
||||
* <a href="http://www.ibm.com/developerworks/websphere/library/techarticles/0404_tang/0404_tang.html">IBM developerWorks article</a>).
|
||||
* @param isolationLevel the isolation level to apply (or <code>null</code> if none)
|
||||
* @param readOnlyFlag the read-only flag to apply (or <code>null</code> if none)
|
||||
* @param username the username to apply (<code>null</code> or empty indicates the default)
|
||||
* @param password the password to apply (may be <code>null</code> or empty)
|
||||
* @param isolationLevel the isolation level to apply (or {@code null} if none)
|
||||
* @param readOnlyFlag the read-only flag to apply (or {@code null} if none)
|
||||
* @param username the username to apply ({@code null} or empty indicates the default)
|
||||
* @param password the password to apply (may be {@code null} or empty)
|
||||
* @throws SQLException if thrown by JDBCConnectionSpec API methods
|
||||
* @see com.ibm.websphere.rsadapter.JDBCConnectionSpec
|
||||
*/
|
||||
|
||||
@@ -96,8 +96,8 @@ public class EmbeddedDatabaseBuilder {
|
||||
|
||||
/**
|
||||
* Add default scripts to execute to populate the database.
|
||||
* <p>The default scripts are <code>schema.sql</code> to create the db
|
||||
* schema and <code>data.sql</code> to populate the db with data.
|
||||
* <p>The default scripts are {@code schema.sql} to create the db
|
||||
* schema and {@code data.sql} to populate the db with data.
|
||||
* @return this, to facilitate method chaining
|
||||
*/
|
||||
public EmbeddedDatabaseBuilder addDefaultScripts() {
|
||||
|
||||
@@ -156,7 +156,7 @@ public class EmbeddedDatabaseFactory {
|
||||
|
||||
/**
|
||||
* Hook that gets the DataSource that provides the connectivity to the embedded database.
|
||||
* <p>Returns <code>null</code> if the DataSource has not been initialized or the database
|
||||
* <p>Returns {@code null} if the DataSource has not been initialized or the database
|
||||
* has been shut down. Subclasses may call to access the DataSource instance directly.
|
||||
*/
|
||||
protected final DataSource getDataSource() {
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class AbstractRoutingDataSource extends AbstractDataSource imple
|
||||
* in the target DataSource map - simply falling back to the default DataSource
|
||||
* in that case.
|
||||
* <p>Switch this flag to "false" if you would prefer the fallback to only apply
|
||||
* if the lookup key was <code>null</code>. Lookup keys without a DataSource
|
||||
* if the lookup key was {@code null}. Lookup keys without a DataSource
|
||||
* entry will then lead to an IllegalStateException.
|
||||
* @see #setTargetDataSources
|
||||
* @see #setDefaultTargetDataSource
|
||||
@@ -141,7 +141,7 @@ public abstract class AbstractRoutingDataSource extends AbstractDataSource imple
|
||||
* names (to be resolved via a {@link #setDataSourceLookup DataSourceLookup}).
|
||||
* @param dataSource the data source value object as specified in the
|
||||
* {@link #setTargetDataSources targetDataSources} map
|
||||
* @return the resolved DataSource (never <code>null</code>)
|
||||
* @return the resolved DataSource (never {@code null})
|
||||
* @throws IllegalArgumentException in case of an unsupported value type
|
||||
*/
|
||||
protected DataSource resolveSpecifiedDataSource(Object dataSource) throws IllegalArgumentException {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.util.Assert;
|
||||
* {@link DataSourceLookup} implementation based on a Spring {@link BeanFactory}.
|
||||
*
|
||||
* <p>Will lookup Spring managed beans identified by bean name,
|
||||
* expecting them to be of type <code>javax.sql.DataSource</code>.
|
||||
* expecting them to be of type {@code javax.sql.DataSource}.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Juergen Hoeller
|
||||
@@ -41,7 +41,7 @@ public class BeanFactoryDataSourceLookup implements DataSourceLookup, BeanFactor
|
||||
|
||||
/**
|
||||
* Create a new instance of the {@link BeanFactoryDataSourceLookup} class.
|
||||
* <p>The BeanFactory to access must be set via <code>setBeanFactory</code>.
|
||||
* <p>The BeanFactory to access must be set via {@code setBeanFactory}.
|
||||
* @see #setBeanFactory
|
||||
*/
|
||||
public BeanFactoryDataSourceLookup() {
|
||||
|
||||
@@ -22,7 +22,7 @@ import javax.sql.DataSource;
|
||||
* Strategy interface for looking up DataSources by name.
|
||||
*
|
||||
* <p>Used, for example, to resolve data source names in JPA
|
||||
* <code>persistence.xml</code> files.
|
||||
* {@code persistence.xml} files.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Juergen Hoeller
|
||||
@@ -34,7 +34,7 @@ public interface DataSourceLookup {
|
||||
/**
|
||||
* Retrieve the DataSource identified by the given name.
|
||||
* @param dataSourceName the name of the DataSource
|
||||
* @return the DataSource (never <code>null</code>)
|
||||
* @return the DataSource (never {@code null})
|
||||
* @throws DataSourceLookupFailureException if the lookup failed
|
||||
*/
|
||||
DataSource getDataSource(String dataSourceName) throws DataSourceLookupFailureException;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class MapDataSourceLookup implements DataSourceLookup {
|
||||
/**
|
||||
* Set the {@link Map} of {@link DataSource DataSources}; the keys
|
||||
* are {@link String Strings}, the values are actual {@link DataSource} instances.
|
||||
* <p>If the supplied {@link Map} is <code>null</code>, then this method
|
||||
* <p>If the supplied {@link Map} is {@code null}, then this method
|
||||
* call effectively has no effect.
|
||||
* @param dataSources said {@link Map} of {@link DataSource DataSources}
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ public class MapDataSourceLookup implements DataSourceLookup {
|
||||
/**
|
||||
* Get the {@link Map} of {@link DataSource DataSources} maintained by this object.
|
||||
* <p>The returned {@link Map} is {@link Collections#unmodifiableMap(java.util.Map) unmodifiable}.
|
||||
* @return said {@link Map} of {@link DataSource DataSources} (never <code>null</code>)
|
||||
* @return said {@link Map} of {@link DataSource DataSources} (never {@code null})
|
||||
*/
|
||||
public Map<String, DataSource> getDataSources() {
|
||||
return Collections.unmodifiableMap(this.dataSources);
|
||||
|
||||
@@ -30,11 +30,11 @@ import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
/**
|
||||
* SqlUpdate subclass that performs batch update operations. Encapsulates
|
||||
* queuing up records to be updated, and adds them as a single batch once
|
||||
* <code>flush</code> is called or the given batch size has been met.
|
||||
* {@code flush} is called or the given batch size has been met.
|
||||
*
|
||||
* <p>Note that this class is a <b>non-thread-safe object</b>, in contrast
|
||||
* to all other JDBC operations objects in this package. You need to create
|
||||
* a new instance of it for each use, or call <code>reset</code> before
|
||||
* a new instance of it for each use, or call {@code reset} before
|
||||
* reuse within the same thread.
|
||||
*
|
||||
* @author Keith Donald
|
||||
@@ -85,7 +85,7 @@ public class BatchSqlUpdate extends SqlUpdate {
|
||||
* @param ds DataSource to use to obtain connections
|
||||
* @param sql SQL statement to execute
|
||||
* @param types SQL types of the parameters, as defined in the
|
||||
* <code>java.sql.Types</code> class
|
||||
* {@code java.sql.Types} class
|
||||
* @see java.sql.Types
|
||||
*/
|
||||
public BatchSqlUpdate(DataSource ds, String sql, int[] types) {
|
||||
@@ -99,7 +99,7 @@ public class BatchSqlUpdate extends SqlUpdate {
|
||||
* @param ds DataSource to use to obtain connections
|
||||
* @param sql SQL statement to execute
|
||||
* @param types SQL types of the parameters, as defined in the
|
||||
* <code>java.sql.Types</code> class
|
||||
* {@code java.sql.Types} class
|
||||
* @param batchSize the number of statements that will trigger
|
||||
* an automatic intermediate flush
|
||||
* @see java.sql.Types
|
||||
@@ -112,11 +112,11 @@ public class BatchSqlUpdate extends SqlUpdate {
|
||||
|
||||
/**
|
||||
* Set the number of statements that will trigger an automatic intermediate
|
||||
* flush. <code>update</code> calls or the given statement parameters will
|
||||
* flush. {@code update} calls or the given statement parameters will
|
||||
* be queued until the batch size is met, at which point it will empty the
|
||||
* queue and execute the batch.
|
||||
* <p>You can also flush already queued statements with an explicit
|
||||
* <code>flush</code> call. Note that you need to this after queueing
|
||||
* {@code flush} call. Note that you need to this after queueing
|
||||
* all parameters to guarantee that all statements have been flushed.
|
||||
*/
|
||||
public void setBatchSize(int batchSize) {
|
||||
@@ -144,13 +144,13 @@ public class BatchSqlUpdate extends SqlUpdate {
|
||||
|
||||
|
||||
/**
|
||||
* Overridden version of <code>update</code> that adds the given statement
|
||||
* Overridden version of {@code update} that adds the given statement
|
||||
* parameters to the queue rather than executing them immediately.
|
||||
* All other <code>update</code> methods of the SqlUpdate base class go
|
||||
* All other {@code update} methods of the SqlUpdate base class go
|
||||
* through this method and will thus behave similarly.
|
||||
* <p>You need to call <code>flush</code> to actually execute the batch.
|
||||
* <p>You need to call {@code flush} to actually execute the batch.
|
||||
* If the specified batch size is reached, an implicit flush will happen;
|
||||
* you still need to finally call <code>flush</code> to flush all statements.
|
||||
* you still need to finally call {@code flush} to flush all statements.
|
||||
* @param params array of parameter objects
|
||||
* @return the number of rows affected by the update (always -1,
|
||||
* meaning "not applicable", as the statement is not actually
|
||||
@@ -220,8 +220,8 @@ public class BatchSqlUpdate extends SqlUpdate {
|
||||
|
||||
/**
|
||||
* Return the number of affected rows for all already executed statements.
|
||||
* Accumulates all of <code>flush</code>'s return values until
|
||||
* <code>reset</code> is invoked.
|
||||
* Accumulates all of {@code flush}'s return values until
|
||||
* {@code reset} is invoked.
|
||||
* @return an array of the number of rows affected by each statement
|
||||
* @see #reset
|
||||
*/
|
||||
|
||||
@@ -81,9 +81,9 @@ public abstract class MappingSqlQueryWithParameters<T> extends SqlQuery<T> {
|
||||
* @param rowNum row number (from 0) we're up to
|
||||
* @param parameters to the query (passed to the execute() method).
|
||||
* Subclasses are rarely interested in these.
|
||||
* It can be <code>null</code> if there are no parameters.
|
||||
* It can be {@code null} if there are no parameters.
|
||||
* @param context passed to the execute() method.
|
||||
* It can be <code>null</code> if no contextual information is need.
|
||||
* It can be {@code null} if no contextual information is need.
|
||||
* @return an object of the result type
|
||||
* @throws SQLException if there's an error extracting data.
|
||||
* Subclasses can simply not catch SQLExceptions, relying on the
|
||||
@@ -95,7 +95,7 @@ public abstract class MappingSqlQueryWithParameters<T> extends SqlQuery<T> {
|
||||
|
||||
/**
|
||||
* Implementation of RowMapper that calls the enclosing
|
||||
* class's <code>mapRow</code> method for each row.
|
||||
* class's {@code mapRow} method for each row.
|
||||
*/
|
||||
protected class RowMapperImpl implements RowMapper<T> {
|
||||
|
||||
|
||||
@@ -41,12 +41,12 @@ import org.springframework.jdbc.core.SqlParameter;
|
||||
*
|
||||
* <p>This class and subclasses throw runtime exceptions, defined in the
|
||||
* <codeorg.springframework.dao package</code> (and as thrown by the
|
||||
* <code>org.springframework.jdbc.core</code> package, which the classes
|
||||
* {@code org.springframework.jdbc.core} package, which the classes
|
||||
* in this package use under the hood to perform raw JDBC operations).
|
||||
*
|
||||
* <p>Subclasses should set SQL and add parameters before invoking the
|
||||
* {@link #compile()} method. The order in which parameters are added is
|
||||
* significant. The appropriate <code>execute</code> or <code>update</code>
|
||||
* significant. The appropriate {@code execute} or {@code update}
|
||||
* method can then be invoked.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
@@ -243,11 +243,11 @@ public abstract class RdbmsOperation implements InitializingBean {
|
||||
|
||||
/**
|
||||
* Add anonymous parameters, specifying only their SQL types
|
||||
* as defined in the <code>java.sql.Types</code> class.
|
||||
* as defined in the {@code java.sql.Types} class.
|
||||
* <p>Parameter ordering is significant. This method is an alternative
|
||||
* to the {@link #declareParameter} method, which should normally be preferred.
|
||||
* @param types array of SQL types as defined in the
|
||||
* <code>java.sql.Types</code> class
|
||||
* {@code java.sql.Types} class
|
||||
* @throws InvalidDataAccessApiUsageException if the operation is already compiled
|
||||
*/
|
||||
public void setTypes(int[] types) throws InvalidDataAccessApiUsageException {
|
||||
@@ -358,7 +358,7 @@ public abstract class RdbmsOperation implements InitializingBean {
|
||||
/**
|
||||
* Check whether this operation has been compiled already;
|
||||
* lazily compile it if not already compiled.
|
||||
* <p>Automatically called by <code>validateParameters</code>.
|
||||
* <p>Automatically called by {@code validateParameters}.
|
||||
* @see #validateParameters
|
||||
*/
|
||||
protected void checkCompiled() {
|
||||
@@ -370,9 +370,9 @@ public abstract class RdbmsOperation implements InitializingBean {
|
||||
|
||||
/**
|
||||
* Validate the parameters passed to an execute method based on declared parameters.
|
||||
* Subclasses should invoke this method before every <code>executeQuery()</code>
|
||||
* or <code>update()</code> method.
|
||||
* @param parameters parameters supplied (may be <code>null</code>)
|
||||
* Subclasses should invoke this method before every {@code executeQuery()}
|
||||
* or {@code update()} method.
|
||||
* @param parameters parameters supplied (may be {@code null})
|
||||
* @throws InvalidDataAccessApiUsageException if the parameters are invalid
|
||||
*/
|
||||
protected void validateParameters(Object[] parameters) throws InvalidDataAccessApiUsageException {
|
||||
@@ -393,9 +393,9 @@ public abstract class RdbmsOperation implements InitializingBean {
|
||||
|
||||
/**
|
||||
* Validate the named parameters passed to an execute method based on declared parameters.
|
||||
* Subclasses should invoke this method before every <code>executeQuery()</code> or
|
||||
* <code>update()</code> method.
|
||||
* @param parameters parameter Map supplied. May be <code>null</code>.
|
||||
* Subclasses should invoke this method before every {@code executeQuery()} or
|
||||
* {@code update()} method.
|
||||
* @param parameters parameter Map supplied. May be {@code null}.
|
||||
* @throws InvalidDataAccessApiUsageException if the parameters are invalid
|
||||
*/
|
||||
protected void validateNamedParameters(Map<String, ?> parameters) throws InvalidDataAccessApiUsageException {
|
||||
@@ -447,7 +447,7 @@ public abstract class RdbmsOperation implements InitializingBean {
|
||||
|
||||
/**
|
||||
* Return whether BLOB/CLOB parameters are supported for this kind of operation.
|
||||
* <p>The default is <code>true</code>.
|
||||
* <p>The default is {@code true}.
|
||||
*/
|
||||
protected boolean supportsLobParameters() {
|
||||
return true;
|
||||
@@ -456,7 +456,7 @@ public abstract class RdbmsOperation implements InitializingBean {
|
||||
/**
|
||||
* Return whether this operation accepts additional parameters that are
|
||||
* given but not actually used. Applies in particular to parameter Maps.
|
||||
* <p>The default is <code>false</code>.
|
||||
* <p>The default is {@code false}.
|
||||
* @see StoredProcedure
|
||||
*/
|
||||
protected boolean allowsUnusedParameters() {
|
||||
|
||||
@@ -68,7 +68,7 @@ public abstract class SqlCall extends RdbmsOperation {
|
||||
/**
|
||||
* Constructor to allow use as a JavaBean.
|
||||
* A DataSource, SQL and any parameters must be supplied before
|
||||
* invoking the <code>compile</code> method and using this object.
|
||||
* invoking the {@code compile} method and using this object.
|
||||
* @see #setDataSource
|
||||
* @see #setSql
|
||||
* @see #compile
|
||||
@@ -179,7 +179,7 @@ public abstract class SqlCall extends RdbmsOperation {
|
||||
/**
|
||||
* Return a CallableStatementCreator to perform an operation
|
||||
* with this parameters.
|
||||
* @param inParams parameters. May be <code>null</code>.
|
||||
* @param inParams parameters. May be {@code null}.
|
||||
*/
|
||||
protected CallableStatementCreator newCallableStatementCreator(Map<String, ?> inParams) {
|
||||
return this.callableStatementFactory.newCallableStatementCreator(inParams);
|
||||
@@ -188,7 +188,7 @@ public abstract class SqlCall extends RdbmsOperation {
|
||||
/**
|
||||
* Return a CallableStatementCreator to perform an operation
|
||||
* with the parameters returned from this ParameterMapper.
|
||||
* @param inParamMapper parametermapper. May not be <code>null</code>.
|
||||
* @param inParamMapper parametermapper. May not be {@code null}.
|
||||
*/
|
||||
protected CallableStatementCreator newCallableStatementCreator(ParameterMapper inParamMapper) {
|
||||
return this.callableStatementFactory.newCallableStatementCreator(inParamMapper);
|
||||
|
||||
@@ -36,16 +36,16 @@ import org.springframework.jdbc.core.SingleColumnRowMapper;
|
||||
*
|
||||
* <p>This is a concrete class, which there is often no need to subclass.
|
||||
* Code using this package can create an object of this type, declaring SQL
|
||||
* and parameters, and then invoke the appropriate <code>run</code> method
|
||||
* and parameters, and then invoke the appropriate {@code run} method
|
||||
* repeatedly to execute the function. Subclasses are only supposed to add
|
||||
* specialized <code>run</code> methods for specific parameter and return types.
|
||||
* specialized {@code run} methods for specific parameter and return types.
|
||||
*
|
||||
* <p>Like all RdbmsOperation objects, SqlFunction objects are thread-safe.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Jean-Pierre Pawlak
|
||||
* @see org.springframework.jdbc.object.StoredProcedure
|
||||
* @see StoredProcedure
|
||||
*/
|
||||
public class SqlFunction<T> extends MappingSqlQuery<T> {
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
|
||||
/**
|
||||
* Constructor to allow use as a JavaBean.
|
||||
* A DataSource, SQL and any parameters must be supplied before
|
||||
* invoking the <code>compile</code> method and using this object.
|
||||
* invoking the {@code compile} method and using this object.
|
||||
* @see #setDataSource
|
||||
* @see #setSql
|
||||
* @see #compile
|
||||
@@ -81,7 +81,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
|
||||
* @param ds DataSource to obtain connections from
|
||||
* @param sql SQL to execute
|
||||
* @param types SQL types of the parameters, as defined in the
|
||||
* <code>java.sql.Types</code> class
|
||||
* {@code java.sql.Types} class
|
||||
* @see java.sql.Types
|
||||
*/
|
||||
public SqlFunction(DataSource ds, String sql, int[] types) {
|
||||
@@ -96,7 +96,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
|
||||
* @param ds DataSource to obtain connections from
|
||||
* @param sql SQL to execute
|
||||
* @param types SQL types of the parameters, as defined in the
|
||||
* <code>java.sql.Types</code> class
|
||||
* {@code java.sql.Types} class
|
||||
* @param resultType the type that the result object is required to match
|
||||
* @see #setResultType(Class)
|
||||
* @see java.sql.Types
|
||||
@@ -182,7 +182,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Analogous to the <code>SqlQuery.findObject(Object[])</code> method.
|
||||
* Analogous to the {@code SqlQuery.findObject(Object[])} method.
|
||||
* This is a generic method to execute a query, taken a number of arguments.
|
||||
* @param parameters array of parameters. These will be objects or
|
||||
* object wrapper types for primitives.
|
||||
|
||||
@@ -90,7 +90,7 @@ public abstract class SqlOperation extends RdbmsOperation {
|
||||
/**
|
||||
* Return a PreparedStatementSetter to perform an operation
|
||||
* with the given parameters.
|
||||
* @param params the parameter array (may be <code>null</code>)
|
||||
* @param params the parameter array (may be {@code null})
|
||||
*/
|
||||
protected final PreparedStatementSetter newPreparedStatementSetter(Object[] params) {
|
||||
return this.preparedStatementFactory.newPreparedStatementSetter(params);
|
||||
@@ -99,7 +99,7 @@ public abstract class SqlOperation extends RdbmsOperation {
|
||||
/**
|
||||
* Return a PreparedStatementCreator to perform an operation
|
||||
* with the given parameters.
|
||||
* @param params the parameter array (may be <code>null</code>)
|
||||
* @param params the parameter array (may be {@code null})
|
||||
*/
|
||||
protected final PreparedStatementCreator newPreparedStatementCreator(Object[] params) {
|
||||
return this.preparedStatementFactory.newPreparedStatementCreator(params);
|
||||
@@ -110,7 +110,7 @@ public abstract class SqlOperation extends RdbmsOperation {
|
||||
* with the given parameters.
|
||||
* @param sqlToUse the actual SQL statement to use (if different from
|
||||
* the factory's, for example because of named parameter expanding)
|
||||
* @param params the parameter array (may be <code>null</code>)
|
||||
* @param params the parameter array (may be {@code null})
|
||||
*/
|
||||
protected final PreparedStatementCreator newPreparedStatementCreator(String sqlToUse, Object[] params) {
|
||||
return this.preparedStatementFactory.newPreparedStatementCreator(sqlToUse, params);
|
||||
|
||||
@@ -33,17 +33,17 @@ import org.springframework.jdbc.core.namedparam.ParsedSql;
|
||||
*
|
||||
* <p>Subclasses must implement the {@link #newRowMapper} method to provide
|
||||
* an object that can extract the results of iterating over the
|
||||
* <code>ResultSet</code> created during the execution of the query.
|
||||
* {@code ResultSet} created during the execution of the query.
|
||||
*
|
||||
* <p>This class provides a number of public <code>execute</code> methods that are
|
||||
* <p>This class provides a number of public {@code execute} methods that are
|
||||
* analogous to the different convenient JDO query execute methods. Subclasses
|
||||
* can either rely on one of these inherited methods, or can add their own
|
||||
* custom execution methods, with meaningful names and typed parameters
|
||||
* (definitely a best practice). Each custom query method will invoke one of
|
||||
* this class's untyped query methods.
|
||||
*
|
||||
* <p>Like all <code>RdbmsOperation</code> classes that ship with the Spring
|
||||
* Framework, <code>SqlQuery</code> instances are thread-safe after their
|
||||
* <p>Like all {@code RdbmsOperation} classes that ship with the Spring
|
||||
* Framework, {@code SqlQuery} instances are thread-safe after their
|
||||
* initialization is complete. That is, after they are constructed and configured
|
||||
* via their setter methods, they can be used safely from multiple threads.
|
||||
*
|
||||
@@ -60,15 +60,15 @@ public abstract class SqlQuery<T> extends SqlOperation {
|
||||
|
||||
/**
|
||||
* Constructor to allow use as a JavaBean.
|
||||
* <p>The <code>DataSource</code> and SQL must be supplied before
|
||||
* <p>The {@code DataSource} and SQL must be supplied before
|
||||
* compilation and use.
|
||||
*/
|
||||
public SqlQuery() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient constructor with a <code>DataSource</code> and SQL string.
|
||||
* @param ds the <code>DataSource</code> to use to get connections
|
||||
* Convenient constructor with a {@code DataSource} and SQL string.
|
||||
* @param ds the {@code DataSource} to use to get connections
|
||||
* @param sql the SQL to execute; SQL can also be supplied at runtime
|
||||
* by overriding the {@link #getSql()} method.
|
||||
*/
|
||||
@@ -100,7 +100,7 @@ public abstract class SqlQuery<T> extends SqlOperation {
|
||||
* @param params parameters, similar to JDO query parameters.
|
||||
* Primitive parameters must be represented by their Object wrapper type.
|
||||
* The ordering of parameters is significant.
|
||||
* @param context contextual information passed to the <code>mapRow</code>
|
||||
* @param context contextual information passed to the {@code mapRow}
|
||||
* callback method. The JDBC operation itself doesn't rely on this parameter,
|
||||
* but it can be useful for creating the objects of the result list.
|
||||
* @return a List of objects, one per row of the ResultSet. Normally all these
|
||||
@@ -213,7 +213,7 @@ public abstract class SqlQuery<T> extends SqlOperation {
|
||||
* the SqlParameters. Primitive parameters must be represented by their Object wrapper
|
||||
* type. The ordering of parameters is not significant since they are supplied in a
|
||||
* SqlParameterMap which is an implementation of the Map interface.
|
||||
* @param context contextual information passed to the <code>mapRow</code>
|
||||
* @param context contextual information passed to the {@code mapRow}
|
||||
* callback method. The JDBC operation itself doesn't rely on this parameter,
|
||||
* but it can be useful for creating the objects of the result list.
|
||||
* @return a List of objects, one per row of the ResultSet. Normally all these
|
||||
@@ -241,10 +241,10 @@ public abstract class SqlQuery<T> extends SqlOperation {
|
||||
|
||||
|
||||
/**
|
||||
* Generic object finder method, used by all other <code>findObject</code> methods.
|
||||
* Generic object finder method, used by all other {@code findObject} methods.
|
||||
* Object finder methods are like EJB entity bean finders, in that it is
|
||||
* considered an error if they return more than one result.
|
||||
* @return the result object, or <code>null</code> if not found. Subclasses may
|
||||
* @return the result object, or {@code null} if not found. Subclasses may
|
||||
* choose to treat this as an error and throw an exception.
|
||||
* @see org.springframework.dao.support.DataAccessUtils#singleResult
|
||||
*/
|
||||
@@ -325,7 +325,7 @@ public abstract class SqlQuery<T> extends SqlOperation {
|
||||
* @param paramMap Map of parameter name to parameter object,
|
||||
* matching named parameters specified in the SQL statement.
|
||||
* Ordering is not significant.
|
||||
* @param context contextual information passed to the <code>mapRow</code>
|
||||
* @param context contextual information passed to the {@code mapRow}
|
||||
* callback method. The JDBC operation itself doesn't rely on this parameter,
|
||||
* but it can be useful for creating the objects of the result list.
|
||||
* @return a List of objects, one per row of the ResultSet. Normally all these
|
||||
@@ -350,10 +350,10 @@ public abstract class SqlQuery<T> extends SqlOperation {
|
||||
/**
|
||||
* Subclasses must implement this method to extract an object per row, to be
|
||||
* returned by the <cod>execute</code> method as an aggregated {@link List}.
|
||||
* @param parameters the parameters to the <code>execute()</code> method,
|
||||
* in case subclass is interested; may be <code>null</code> if there
|
||||
* @param parameters the parameters to the {@code execute()} method,
|
||||
* in case subclass is interested; may be {@code null} if there
|
||||
* were no parameters.
|
||||
* @param context contextual information passed to the <code>mapRow</code>
|
||||
* @param context contextual information passed to the {@code mapRow}
|
||||
* callback method. The JDBC operation itself doesn't rely on this parameter,
|
||||
* but it can be useful for creating the objects of the result list.
|
||||
* @see #execute
|
||||
|
||||
@@ -30,15 +30,15 @@ import org.springframework.jdbc.support.KeyHolder;
|
||||
/**
|
||||
* Reusable operation object representing a SQL update.
|
||||
*
|
||||
* <p>This class provides a number of <code>update</code> methods,
|
||||
* analogous to the <code>execute</code> methods of query objects.
|
||||
* <p>This class provides a number of {@code update} methods,
|
||||
* analogous to the {@code execute} methods of query objects.
|
||||
*
|
||||
* <p>This class is concrete. Although it can be subclassed (for example
|
||||
* to add a custom update method) it can easily be parameterized by setting
|
||||
* SQL and declaring parameters.
|
||||
*
|
||||
* <p>Like all <code>RdbmsOperation</code> classes that ship with the Spring
|
||||
* Framework, <code>SqlQuery</code> instances are thread-safe after their
|
||||
* <p>Like all {@code RdbmsOperation} classes that ship with the Spring
|
||||
* Framework, {@code SqlQuery} instances are thread-safe after their
|
||||
* initialization is complete. That is, after they are constructed and configured
|
||||
* via their setter methods, they can be used safely from multiple threads.
|
||||
*
|
||||
@@ -87,7 +87,7 @@ public class SqlUpdate extends SqlOperation {
|
||||
* @param ds DataSource to use to obtain connections
|
||||
* @param sql SQL statement to execute
|
||||
* @param types SQL types of the parameters, as defined in the
|
||||
* <code>java.sql.Types</code> class
|
||||
* {@code java.sql.Types} class
|
||||
* @see java.sql.Types
|
||||
*/
|
||||
public SqlUpdate(DataSource ds, String sql, int[] types) {
|
||||
@@ -103,7 +103,7 @@ public class SqlUpdate extends SqlOperation {
|
||||
* @param ds DataSource to use to obtain connections
|
||||
* @param sql SQL statement to execute
|
||||
* @param types SQL types of the parameters, as defined in the
|
||||
* <code>java.sql.Types</code> class
|
||||
* {@code java.sql.Types} class
|
||||
* @param maxRowsAffected the maximum number of rows that may
|
||||
* be affected by the update
|
||||
* @see java.sql.Types
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.jdbc.core.SqlParameter;
|
||||
* a typed method for invocation that delegates to the supplied
|
||||
* {@link #execute} method.
|
||||
*
|
||||
* <p>The inherited <code>sql</code> property is the name of the stored
|
||||
* <p>The inherited {@code sql} property is the name of the stored
|
||||
* procedure in the RDBMS. Note that JDBC 3.0 introduces named parameters,
|
||||
* although the other features provided by this class are still necessary
|
||||
* in JDBC 3.0.
|
||||
@@ -82,9 +82,9 @@ public abstract class StoredProcedure extends SqlCall {
|
||||
|
||||
/**
|
||||
* Declare a parameter. Overridden method.
|
||||
* Parameters declared as <code>SqlParameter</code> and <code>SqlInOutParameter</code>
|
||||
* Parameters declared as {@code SqlParameter} and {@code SqlInOutParameter}
|
||||
* will always be used to provide input values. In addition to this any parameter declared
|
||||
* as <code>SqlOutParameter</code> where an non-null input value is provided will also be used
|
||||
* as {@code SqlOutParameter} where an non-null input value is provided will also be used
|
||||
* as an input paraneter.
|
||||
* <b>Note: Calls to declareParameter must be made in the same order as
|
||||
* they appear in the database's stored procedure parameter list.</b>
|
||||
@@ -105,7 +105,7 @@ public abstract class StoredProcedure extends SqlCall {
|
||||
* must match the order that the parameters where declared in.
|
||||
* @param inParams variable number of input parameters. Output parameters should
|
||||
* not be included in this map.
|
||||
* It is legal for values to be <code>null</code>, and this will produce the
|
||||
* It is legal for values to be {@code null}, and this will produce the
|
||||
* correct behavior using a NULL argument to the stored procedure.
|
||||
* @return map of output params, keyed by name as in parameter declarations.
|
||||
* Output parameters will appear here, with their values after the
|
||||
@@ -133,7 +133,7 @@ public abstract class StoredProcedure extends SqlCall {
|
||||
* Alternatively, they can return void.
|
||||
* @param inParams map of input parameters, keyed by name as in parameter
|
||||
* declarations. Output parameters need not (but can) be included in this map.
|
||||
* It is legal for map entries to be <code>null</code>, and this will produce the
|
||||
* It is legal for map entries to be {@code null}, and this will produce the
|
||||
* correct behavior using a NULL argument to the stored procedure.
|
||||
* @return map of output params, keyed by name as in parameter declarations.
|
||||
* Output parameters will appear here, with their values after the
|
||||
@@ -154,7 +154,7 @@ public abstract class StoredProcedure extends SqlCall {
|
||||
* Alternatively, they can return void.
|
||||
* @param inParamMapper map of input parameters, keyed by name as in parameter
|
||||
* declarations. Output parameters need not (but can) be included in this map.
|
||||
* It is legal for map entries to be <code>null</code>, and this will produce the correct
|
||||
* It is legal for map entries to be {@code null}, and this will produce the correct
|
||||
* behavior using a NULL argument to the stored procedure.
|
||||
* @return map of output params, keyed by name as in parameter declarations.
|
||||
* Output parameters will appear here, with their values after the
|
||||
|
||||
@@ -57,7 +57,7 @@ public abstract class UpdatableSqlQuery<T> extends SqlQuery<T> {
|
||||
|
||||
/**
|
||||
* Implementation of the superclass template method. This invokes the subclass's
|
||||
* implementation of the <code>updateRow()</code> method.
|
||||
* implementation of the {@code updateRow()} method.
|
||||
*/
|
||||
@Override
|
||||
protected RowMapper<T> newRowMapper(Object[] parameters, Map context) {
|
||||
@@ -70,7 +70,7 @@ public abstract class UpdatableSqlQuery<T> extends SqlQuery<T> {
|
||||
* @param rs ResultSet we're working through
|
||||
* @param rowNum row number (from 0) we're up to
|
||||
* @param context passed to the execute() method.
|
||||
* It can be <code>null</code> if no contextual information is need. If you
|
||||
* It can be {@code null} if no contextual information is need. If you
|
||||
* need to pass in data for each row, you can pass in a HashMap with
|
||||
* the primary key of the row being the key for the HashMap. That way
|
||||
* it is easy to locate the updates for each row
|
||||
@@ -84,7 +84,7 @@ public abstract class UpdatableSqlQuery<T> extends SqlQuery<T> {
|
||||
|
||||
/**
|
||||
* Implementation of RowMapper that calls the enclosing
|
||||
* class's <code>updateRow()</code> method for each row.
|
||||
* class's {@code updateRow()} method for each row.
|
||||
*/
|
||||
protected class RowMapperImpl implements RowMapper<T> {
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* The classes in this package represent RDBMS queries, updates,
|
||||
@@ -7,8 +6,8 @@
|
||||
* are "disconnected" from the database.
|
||||
*
|
||||
* <p>This higher level of JDBC abstraction depends on the lower-level
|
||||
* abstraction in the <code>org.springframework.jdbc.core</code> package.
|
||||
* Exceptions thrown are as in the <code>org.springframework.dao</code> package,
|
||||
* abstraction in the {@code org.springframework.jdbc.core} package.
|
||||
* Exceptions thrown are as in the {@code org.springframework.dao} package,
|
||||
* meaning that code using this package does not need to implement JDBC or
|
||||
* RDBMS-specific error handling.
|
||||
*
|
||||
|
||||
@@ -86,25 +86,25 @@ public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExcep
|
||||
/**
|
||||
* Template method for actually translating the given exception.
|
||||
* <p>The passed-in arguments will have been pre-checked. Furthermore, this method
|
||||
* is allowed to return <code>null</code> to indicate that no exception match has
|
||||
* is allowed to return {@code null} to indicate that no exception match has
|
||||
* been found and that fallback translation should kick in.
|
||||
* @param task readable text describing the task being attempted
|
||||
* @param sql SQL query or update that caused the problem (may be <code>null</code>)
|
||||
* @param ex the offending <code>SQLException</code>
|
||||
* @return the DataAccessException, wrapping the <code>SQLException</code>;
|
||||
* or <code>null</code> if no exception match found
|
||||
* @param sql SQL query or update that caused the problem (may be {@code null})
|
||||
* @param ex the offending {@code SQLException}
|
||||
* @return the DataAccessException, wrapping the {@code SQLException};
|
||||
* or {@code null} if no exception match found
|
||||
*/
|
||||
protected abstract DataAccessException doTranslate(String task, String sql, SQLException ex);
|
||||
|
||||
|
||||
/**
|
||||
* Build a message <code>String</code> for the given {@link java.sql.SQLException}.
|
||||
* Build a message {@code String} for the given {@link java.sql.SQLException}.
|
||||
* <p>To be called by translator subclasses when creating an instance of a generic
|
||||
* {@link org.springframework.dao.DataAccessException} class.
|
||||
* @param task readable text describing the task being attempted
|
||||
* @param sql the SQL statement that caused the problem (may be <code>null</code>)
|
||||
* @param ex the offending <code>SQLException</code>
|
||||
* @return the message <code>String</code> to use
|
||||
* @param sql the SQL statement that caused the problem (may be {@code null})
|
||||
* @param ex the offending {@code SQLException}
|
||||
* @return the message {@code String} to use
|
||||
*/
|
||||
protected String buildMessage(String task, String sql, SQLException ex) {
|
||||
return task + "; SQL [" + sql + "]; " + ex.getMessage();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CustomSQLExceptionTranslatorRegistrar implements InitializingBean {
|
||||
|
||||
/**
|
||||
* Setter for a Map of {@link SQLExceptionTranslator} references where the key must
|
||||
* be the database name as defined in the <code>sql-error-codes.xml</code> file.
|
||||
* be the database name as defined in the {@code sql-error-codes.xml} file.
|
||||
* <p>Note that any existing translators will remain unless there is a match in the
|
||||
* database name, at which point the new translator will replace the existing one.
|
||||
*/
|
||||
|
||||
@@ -84,7 +84,7 @@ public class CustomSQLExceptionTranslatorRegistry {
|
||||
/**
|
||||
* Find a custom translator for the specified database.
|
||||
* @param dbName the database name
|
||||
* @return the custom translator, or <code>null</code> if none found
|
||||
* @return the custom translator, or {@code null} if none found
|
||||
*/
|
||||
public SQLExceptionTranslator findTranslatorForDatabase(String dbName) {
|
||||
return this.translatorMap.get(dbName);
|
||||
|
||||
@@ -109,7 +109,7 @@ public abstract class JdbcAccessor implements InitializingBean {
|
||||
* Set whether to lazily initialize the SQLExceptionTranslator for this accessor,
|
||||
* on first encounter of a SQLException. Default is "true"; can be switched to
|
||||
* "false" for initialization on startup.
|
||||
* <p>Early initialization just applies if <code>afterPropertiesSet()</code> is called.
|
||||
* <p>Early initialization just applies if {@code afterPropertiesSet()} is called.
|
||||
* @see #getExceptionTranslator()
|
||||
* @see #afterPropertiesSet()
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ public abstract class JdbcUtils {
|
||||
/**
|
||||
* Close the given JDBC Connection and ignore any thrown exception.
|
||||
* This is useful for typical finally blocks in manual JDBC code.
|
||||
* @param con the JDBC Connection to close (may be <code>null</code>)
|
||||
* @param con the JDBC Connection to close (may be {@code null})
|
||||
*/
|
||||
public static void closeConnection(Connection con) {
|
||||
if (con != null) {
|
||||
@@ -79,7 +79,7 @@ public abstract class JdbcUtils {
|
||||
/**
|
||||
* Close the given JDBC Statement and ignore any thrown exception.
|
||||
* This is useful for typical finally blocks in manual JDBC code.
|
||||
* @param stmt the JDBC Statement to close (may be <code>null</code>)
|
||||
* @param stmt the JDBC Statement to close (may be {@code null})
|
||||
*/
|
||||
public static void closeStatement(Statement stmt) {
|
||||
if (stmt != null) {
|
||||
@@ -99,7 +99,7 @@ public abstract class JdbcUtils {
|
||||
/**
|
||||
* Close the given JDBC ResultSet and ignore any thrown exception.
|
||||
* This is useful for typical finally blocks in manual JDBC code.
|
||||
* @param rs the JDBC ResultSet to close (may be <code>null</code>)
|
||||
* @param rs the JDBC ResultSet to close (may be {@code null})
|
||||
*/
|
||||
public static void closeResultSet(ResultSet rs) {
|
||||
if (rs != null) {
|
||||
@@ -125,7 +125,7 @@ public abstract class JdbcUtils {
|
||||
* with this case appropriately, e.g. throwing a corresponding exception.
|
||||
* @param rs is the ResultSet holding the data
|
||||
* @param index is the column index
|
||||
* @param requiredType the required value type (may be <code>null</code>)
|
||||
* @param requiredType the required value type (may be {@code null})
|
||||
* @return the value object
|
||||
* @throws SQLException if thrown by the JDBC API
|
||||
*/
|
||||
@@ -209,11 +209,11 @@ public abstract class JdbcUtils {
|
||||
* value type. The returned value should be a detached value object, not having
|
||||
* any ties to the active ResultSet: in particular, it should not be a Blob or
|
||||
* Clob object but rather a byte array respectively String representation.
|
||||
* <p>Uses the <code>getObject(index)</code> method, but includes additional "hacks"
|
||||
* <p>Uses the {@code getObject(index)} method, but includes additional "hacks"
|
||||
* to get around Oracle 10g returning a non-standard object for its TIMESTAMP
|
||||
* datatype and a <code>java.sql.Date</code> for DATE columns leaving out the
|
||||
* datatype and a {@code java.sql.Date} for DATE columns leaving out the
|
||||
* time portion: These columns will explicitly be extracted as standard
|
||||
* <code>java.sql.Timestamp</code> object.
|
||||
* {@code java.sql.Timestamp} object.
|
||||
* @param rs is the ResultSet holding the data
|
||||
* @param index is the column index
|
||||
* @return the value object
|
||||
@@ -269,7 +269,7 @@ public abstract class JdbcUtils {
|
||||
* @param dataSource the DataSource to extract metadata for
|
||||
* @param action callback that will do the actual work
|
||||
* @return object containing the extracted information, as returned by
|
||||
* the DatabaseMetaDataCallback's <code>processMetaData</code> method
|
||||
* the DatabaseMetaDataCallback's {@code processMetaData} method
|
||||
* @throws MetaDataAccessException if meta data access failed
|
||||
*/
|
||||
public static Object extractDatabaseMetaData(DataSource dataSource, DatabaseMetaDataCallback action)
|
||||
@@ -349,7 +349,7 @@ public abstract class JdbcUtils {
|
||||
* to decide whether the set of SQL statements should be executed through
|
||||
* the JDBC 2.0 batch mechanism or simply in a traditional one-by-one fashion.
|
||||
* <p>Logs a warning if the "supportsBatchUpdates" methods throws an exception
|
||||
* and simply returns <code>false</code> in that case.
|
||||
* and simply returns {@code false} in that case.
|
||||
* @param con the Connection to check
|
||||
* @return whether JDBC 2.0 batch updates are supported
|
||||
* @see java.sql.DatabaseMetaData#supportsBatchUpdates()
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
* for each row of keys.
|
||||
*
|
||||
* <p>Most applications only use on key per row and process only one row at a
|
||||
* time in an insert statement. In these cases, just call <code>getKey</code>
|
||||
* time in an insert statement. In these cases, just call {@code getKey}
|
||||
* to retrieve the key. The returned value is a Number here, which is the
|
||||
* usual type for auto-generated keys.
|
||||
*
|
||||
|
||||
@@ -49,7 +49,7 @@ import org.springframework.jdbc.InvalidResultSetAccessException;
|
||||
* defining error code mappings for database names from database metadata.
|
||||
* <li>Fallback to a fallback translator. {@link SQLStateSQLExceptionTranslator} is the
|
||||
* default fallback translator, analyzing the exception's SQL state only. On Java 6
|
||||
* which introduces its own <code>SQLException</code> subclass hierarchy, we will
|
||||
* which introduces its own {@code SQLException} subclass hierarchy, we will
|
||||
* use {@link SQLExceptionSubclassTranslator} by default, which in turns falls back
|
||||
* to Spring's own SQL state translation when not encountering specific subclasses.
|
||||
* </ul>
|
||||
@@ -290,7 +290,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
|
||||
* Subclasses can override this method to attempt a custom mapping from SQLException
|
||||
* to DataAccessException.
|
||||
* @param task readable text describing the task being attempted
|
||||
* @param sql SQL query or update that caused the problem. May be <code>null</code>.
|
||||
* @param sql SQL query or update that caused the problem. May be {@code null}.
|
||||
* @param sqlEx the offending SQLException
|
||||
* @return null if no custom translation was possible, otherwise a DataAccessException
|
||||
* resulting from custom translation. This exception should include the sqlEx parameter
|
||||
@@ -305,7 +305,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
|
||||
* Create a custom DataAccessException, based on a given exception
|
||||
* class from a CustomSQLErrorCodesTranslation definition.
|
||||
* @param task readable text describing the task being attempted
|
||||
* @param sql SQL query or update that caused the problem. May be <code>null</code>.
|
||||
* @param sql SQL query or update that caused the problem. May be {@code null}.
|
||||
* @param sqlEx the offending SQLException
|
||||
* @param exceptionClass the exception class to use, as defined in the
|
||||
* CustomSQLErrorCodesTranslation definition
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* <p>Used by Spring's {@link SQLErrorCodeSQLExceptionTranslator}.
|
||||
* The file "sql-error-codes.xml" in this package contains default
|
||||
* <code>SQLErrorCodes</code> instances for various databases.
|
||||
* {@code SQLErrorCodes} instances for various databases.
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.util.PatternMatchUtils;
|
||||
* Factory for creating {@link SQLErrorCodes} based on the
|
||||
* "databaseProductName" taken from the {@link java.sql.DatabaseMetaData}.
|
||||
*
|
||||
* <p>Returns <code>SQLErrorCodes</code> populated with vendor codes
|
||||
* <p>Returns {@code SQLErrorCodes} populated with vendor codes
|
||||
* defined in a configuration file named "sql-error-codes.xml".
|
||||
* Reads the default file in this package if not overridden by a file in
|
||||
* the root of the class path (for example in the "/WEB-INF/classes" directory).
|
||||
@@ -142,7 +142,7 @@ public class SQLErrorCodesFactory {
|
||||
* @param path resource path; either a custom path or one of either
|
||||
* {@link #SQL_ERROR_CODE_DEFAULT_PATH} or
|
||||
* {@link #SQL_ERROR_CODE_OVERRIDE_PATH}.
|
||||
* @return the resource, or <code>null</code> if the resource wasn't found
|
||||
* @return the resource, or {@code null} if the resource wasn't found
|
||||
* @see #getInstance
|
||||
*/
|
||||
protected Resource loadResource(String path) {
|
||||
@@ -153,9 +153,9 @@ public class SQLErrorCodesFactory {
|
||||
/**
|
||||
* Return the {@link SQLErrorCodes} instance for the given database.
|
||||
* <p>No need for a database metadata lookup.
|
||||
* @param dbName the database name (must not be <code>null</code>)
|
||||
* @return the <code>SQLErrorCodes</code> instance for the given database
|
||||
* @throws IllegalArgumentException if the supplied database name is <code>null</code>
|
||||
* @param dbName the database name (must not be {@code null})
|
||||
* @return the {@code SQLErrorCodes} instance for the given database
|
||||
* @throws IllegalArgumentException if the supplied database name is {@code null}
|
||||
*/
|
||||
public SQLErrorCodes getErrorCodes(String dbName) {
|
||||
Assert.notNull(dbName, "Database product name must not be null");
|
||||
@@ -188,9 +188,9 @@ public class SQLErrorCodesFactory {
|
||||
* Return {@link SQLErrorCodes} for the given {@link DataSource},
|
||||
* evaluating "databaseProductName" from the
|
||||
* {@link java.sql.DatabaseMetaData}, or an empty error codes
|
||||
* instance if no <code>SQLErrorCodes</code> were found.
|
||||
* @param dataSource the <code>DataSource</code> identifying the database
|
||||
* @return the corresponding <code>SQLErrorCodes</code> object
|
||||
* instance if no {@code SQLErrorCodes} were found.
|
||||
* @param dataSource the {@code DataSource} identifying the database
|
||||
* @return the corresponding {@code SQLErrorCodes} object
|
||||
* @see java.sql.DatabaseMetaData#getDatabaseProductName()
|
||||
*/
|
||||
public SQLErrorCodes getErrorCodes(DataSource dataSource) {
|
||||
@@ -234,10 +234,10 @@ public class SQLErrorCodesFactory {
|
||||
|
||||
/**
|
||||
* Associate the specified database name with the given {@link DataSource}.
|
||||
* @param dataSource the <code>DataSource</code> identifying the database
|
||||
* @param dataSource the {@code DataSource} identifying the database
|
||||
* @param dbName the corresponding database name as stated in the error codes
|
||||
* definition file (must not be <code>null</code>)
|
||||
* @return the corresponding <code>SQLErrorCodes</code> object
|
||||
* definition file (must not be {@code null})
|
||||
* @return the corresponding {@code SQLErrorCodes} object
|
||||
*/
|
||||
public SQLErrorCodes registerDatabase(DataSource dataSource, String dbName) {
|
||||
synchronized (this.dataSourceCache) {
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.jdbc.BadSqlGrammarException;
|
||||
*
|
||||
* <p>This is only available with JDBC 4.0 and later drivers when using Java 6 or later.
|
||||
* Falls back to a standard {@link SQLStateSQLExceptionTranslator} if the JDBC driver
|
||||
* does not actually expose JDBC 4 compliant <code>SQLException</code> subclasses.
|
||||
* does not actually expose JDBC 4 compliant {@code SQLException} subclasses.
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -38,15 +38,15 @@ public interface SQLExceptionTranslator {
|
||||
/**
|
||||
* Translate the given {@link SQLException} into a generic {@link DataAccessException}.
|
||||
* <p>The returned DataAccessException is supposed to contain the original
|
||||
* <code>SQLException</code> as root cause. However, client code may not generally
|
||||
* {@code SQLException} as root cause. However, client code may not generally
|
||||
* rely on this due to DataAccessExceptions possibly being caused by other resource
|
||||
* APIs as well. That said, a <code>getRootCause() instanceof SQLException</code>
|
||||
* APIs as well. That said, a {@code getRootCause() instanceof SQLException}
|
||||
* check (and subsequent cast) is considered reliable when expecting JDBC-based
|
||||
* access to have happened.
|
||||
* @param task readable text describing the task being attempted
|
||||
* @param sql SQL query or update that caused the problem (may be <code>null</code>)
|
||||
* @param ex the offending <code>SQLException</code>
|
||||
* @return the DataAccessException, wrapping the <code>SQLException</code>
|
||||
* @param sql SQL query or update that caused the problem (may be {@code null})
|
||||
* @param ex the offending {@code SQLException}
|
||||
* @return the DataAccessException, wrapping the {@code SQLException}
|
||||
* @see org.springframework.dao.DataAccessException#getRootCause()
|
||||
*/
|
||||
DataAccessException translate(String task, String sql, SQLException ex);
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.sql.SQLException;
|
||||
* Simple interface for complex types to be set as statement parameters.
|
||||
*
|
||||
* <p>Implementations perform the actual work of setting the actual values. They must
|
||||
* implement the callback method <code>setValue</code> which can throw SQLExceptions
|
||||
* implement the callback method {@code setValue} which can throw SQLExceptions
|
||||
* that will be caught and translated by the calling code. This callback method has
|
||||
* access to the underlying Connection via the given PreparedStatement object, if that
|
||||
* should be needed to create any database-specific objects.
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Base implementation of {@link DataFieldMaxValueIncrementer} that delegates
|
||||
* to a single {@link #getNextKey} template method that returns a <code>long</code>.
|
||||
* to a single {@link #getNextKey} template method that returns a {@code long}.
|
||||
* Uses longs for String values, padding with zeroes if required.
|
||||
*
|
||||
* @author Dmitriy Kopylenko
|
||||
|
||||
@@ -88,7 +88,7 @@ public abstract class AbstractSequenceMaxValueIncrementer extends AbstractDataFi
|
||||
/**
|
||||
* Return the database-specific query to use for retrieving a sequence value.
|
||||
* <p>The provided SQL is supposed to result in a single row with a single
|
||||
* column that allows for extracting a <code>long</code> value.
|
||||
* column that allows for extracting a {@code long} value.
|
||||
*/
|
||||
protected abstract String getSequenceQuery();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user