summaryrefslogtreecommitdiff
path: root/spring-jdbc/src/main
diff options
context:
space:
mode:
authorEmmanuel Bourg <ebourg@apache.org>2015-04-27 22:17:19 +0200
committerEmmanuel Bourg <ebourg@apache.org>2015-04-27 22:17:19 +0200
commitc03c348db4e91c613982cbe6c99d0cf04ea14fe3 (patch)
tree44c35266a934422967cb12e1f51672a2bd54e667 /spring-jdbc/src/main
parentc56370beb0a2bfa263e125fce107dceccee89fd3 (diff)
Imported Upstream version 3.2.13
Diffstat (limited to 'spring-jdbc/src/main')
-rwxr-xr-xspring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java41
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java57
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java82
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java6
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java96
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsert.java3
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java38
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java16
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java125
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java13
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java335
-rw-r--r--spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSetMetaData.java44
12 files changed, 441 insertions, 415 deletions
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java
index dacff255..70daa10b 100755
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/CallMetaDataContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,11 +65,8 @@ public class CallMetaDataContext {
/** List of SqlParameter objects to be used in call execution */
private List<SqlParameter> callParameters = new ArrayList<SqlParameter>();
- /** Default name to use for the return value in the output map */
- private String defaultFunctionReturnName = "return";
-
/** Actual name to use for the return value in the output map */
- private String actualFunctionReturnName = null;
+ private String actualFunctionReturnName;
/** Set of in parameter names to exclude use for any not listed */
private Set<String> limitedInParameterNames = new HashSet<String>();
@@ -77,16 +74,16 @@ public class CallMetaDataContext {
/** List of SqlParameter names for out parameters */
private List<String> outParameterNames = new ArrayList<String>();
- /** should we access call parameter meta data info or not */
- private boolean accessCallParameterMetaData = true;
+ /** Indicates whether this is a procedure or a function **/
+ private boolean function = false;
- /** indicates whether this is a procedure or a function **/
- private boolean function;
+ /** Indicates whether this procedure's return value should be included **/
+ private boolean returnValueRequired = false;
- /** indicates whether this procedure's return value should be included **/
- private boolean returnValueRequired;
+ /** Should we access call parameter meta data info or not */
+ private boolean accessCallParameterMetaData = true;
- /** the provider of call meta data */
+ /** The provider of call meta data */
private CallMetaDataProvider metaDataProvider;
@@ -101,7 +98,7 @@ public class CallMetaDataContext {
* Get the name used for the return value of the function.
*/
public String getFunctionReturnName() {
- return this.actualFunctionReturnName != null ? this.actualFunctionReturnName : this.defaultFunctionReturnName;
+ return (this.actualFunctionReturnName != null ? this.actualFunctionReturnName : "return");
}
/**
@@ -224,7 +221,7 @@ public class CallMetaDataContext {
* @param rowMapper a RowMapper implementation used to map the data returned in the result set
* @return the appropriate SqlParameter
*/
- public SqlParameter createReturnResultSetParameter(String parameterName, RowMapper rowMapper) {
+ public SqlParameter createReturnResultSetParameter(String parameterName, RowMapper<?> rowMapper) {
if (this.metaDataProvider.isReturnResultSetSupported()) {
return new SqlReturnResultSet(parameterName, rowMapper);
}
@@ -434,7 +431,7 @@ public class CallMetaDataContext {
public Map<String, Object> matchInParameterValuesWithCallParameters(SqlParameterSource parameterSource) {
// For parameter source lookups we need to provide case-insensitive lookup support
// since the database metadata is not necessarily providing case sensitive parameter names.
- Map caseInsensitiveParameterNames =
+ Map<String, String> caseInsensitiveParameterNames =
SqlParameterSourceUtils.extractCaseInsensitiveParameterNames(parameterSource);
Map<String, String> callParameterNames = new HashMap<String, String>(this.callParameters.size());
@@ -467,7 +464,7 @@ public class CallMetaDataContext {
}
else {
if (caseInsensitiveParameterNames.containsKey(lowerCaseName)) {
- String sourceName = (String) caseInsensitiveParameterNames.get(lowerCaseName);
+ String sourceName = caseInsensitiveParameterNames.get(lowerCaseName);
matchedParameters.put(parameterName, SqlParameterSourceUtils.getTypedValue(parameterSource, sourceName));
}
else {
@@ -571,15 +568,15 @@ public class CallMetaDataContext {
// and the catalog name since the cataog is used for the package name
if (this.metaDataProvider.isSupportsSchemasInProcedureCalls() &&
!this.metaDataProvider.isSupportsCatalogsInProcedureCalls()) {
- schemaNameToUse = this.metaDataProvider.catalogNameToUse(this.getCatalogName());
- catalogNameToUse = this.metaDataProvider.schemaNameToUse(this.getSchemaName());
+ schemaNameToUse = this.metaDataProvider.catalogNameToUse(getCatalogName());
+ catalogNameToUse = this.metaDataProvider.schemaNameToUse(getSchemaName());
}
else {
- catalogNameToUse = this.metaDataProvider.catalogNameToUse(this.getCatalogName());
- schemaNameToUse = this.metaDataProvider.schemaNameToUse(this.getSchemaName());
+ catalogNameToUse = this.metaDataProvider.catalogNameToUse(getCatalogName());
+ schemaNameToUse = this.metaDataProvider.schemaNameToUse(getSchemaName());
}
- String procedureNameToUse = this.metaDataProvider.procedureNameToUse(this.getProcedureName());
- if (this.isFunction() || this.isReturnValueRequired()) {
+ String procedureNameToUse = this.metaDataProvider.procedureNameToUse(getProcedureName());
+ if (isFunction() || isReturnValueRequired()) {
callString = "{? = call " +
(StringUtils.hasLength(catalogNameToUse) ? catalogNameToUse + "." : "") +
(StringUtils.hasLength(schemaNameToUse) ? schemaNameToUse + "." : "") +
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java
index 299629cc..992c19c9 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcCall.java
@@ -43,6 +43,7 @@ import org.springframework.util.StringUtils;
* This class provides the base SPI for {@link SimpleJdbcCall}.
*
* @author Thomas Risberg
+ * @author Juergen Hoeller
* @since 2.5
*/
public abstract class AbstractJdbcCall {
@@ -63,9 +64,8 @@ public abstract class AbstractJdbcCall {
private final Map<String, RowMapper> declaredRowMappers = new LinkedHashMap<String, RowMapper>();
/**
- * Has this operation been compiled? Compilation means at
- * least checking that a DataSource and sql have been provided,
- * but subclasses may also implement their own custom validation.
+ * Has this operation been compiled? Compilation means at least checking
+ * that a DataSource or JdbcTemplate has been provided.
*/
private boolean compiled = false;
@@ -73,7 +73,7 @@ public abstract class AbstractJdbcCall {
private String callString;
/**
- * Object enabling us to create CallableStatementCreators
+ * A delegate enabling us to create CallableStatementCreators
* efficiently, based on this class's declared parameters.
*/
private CallableStatementCreatorFactory callableStatementFactory;
@@ -92,6 +92,7 @@ public abstract class AbstractJdbcCall {
* @param jdbcTemplate the JdbcTemplate to use
*/
protected AbstractJdbcCall(JdbcTemplate jdbcTemplate) {
+ Assert.notNull(jdbcTemplate, "JdbcTemplate must not be null");
this.jdbcTemplate = jdbcTemplate;
}
@@ -161,6 +162,7 @@ public abstract class AbstractJdbcCall {
/**
* Specify whether this call is a function call.
+ * The default is {@code false}.
*/
public void setFunction(boolean function) {
this.callMetaDataContext.setFunction(function);
@@ -174,7 +176,8 @@ public abstract class AbstractJdbcCall {
}
/**
- * Specify whether the call requires a rerurn value.
+ * Specify whether the call requires a return value.
+ * The default is {@code false}.
*/
public void setReturnValueRequired(boolean returnValueRequired) {
this.callMetaDataContext.setReturnValueRequired(returnValueRequired);
@@ -188,7 +191,8 @@ public abstract class AbstractJdbcCall {
}
/**
- * Specify whether the parameter metadata for the call should be used. The default is true.
+ * Specify whether the parameter metadata for the call should be used.
+ * The default is {@code true}.
*/
public void setAccessCallParameterMetaData(boolean accessCallParameterMetaData) {
this.callMetaDataContext.setAccessCallParameterMetaData(accessCallParameterMetaData);
@@ -211,10 +215,10 @@ public abstract class AbstractJdbcCall {
/**
* Add a declared parameter to the list of parameters for the call.
- * 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}.
+ * <p>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}.
* @param parameter the {@link SqlParameter} to add
*/
public void addDeclaredParameter(SqlParameter parameter) {
@@ -256,9 +260,9 @@ public abstract class AbstractJdbcCall {
//-------------------------------------------------------------------------
/**
- * Compile this JdbcCall using provided parameters and meta data plus other settings. This
- * finalizes the configuration for this object and subsequent attempts to compile are ignored.
- * This will be implicitly called the first time an un-compiled call is executed.
+ * Compile this JdbcCall using provided parameters and meta data plus other settings.
+ * <p>This finalizes the configuration for this object and subsequent attempts to compile are
+ * ignored. This will be implicitly called the first time an un-compiled call is executed.
* @throws org.springframework.dao.InvalidDataAccessApiUsageException if the object hasn't
* been correctly initialized, for example if no DataSource has been provided
*/
@@ -276,19 +280,21 @@ public abstract class AbstractJdbcCall {
compileInternal();
this.compiled = true;
if (logger.isDebugEnabled()) {
- logger.debug("SqlCall for " + (isFunction() ? "function" : "procedure") + " [" + getProcedureName() + "] compiled");
+ logger.debug("SqlCall for " + (isFunction() ? "function" : "procedure") +
+ " [" + getProcedureName() + "] compiled");
}
}
}
/**
- * Method to perform the actual compilation. Subclasses can override this template method to perform
- * their own compilation. Invoked after this base class's compilation is complete.
+ * Delegate method to perform the actual compilation.
+ * <p>Subclasses can override this template method to perform their own compilation.
+ * Invoked after this base class's compilation is complete.
*/
protected void compileInternal() {
this.callMetaDataContext.initializeMetaData(getJdbcTemplate().getDataSource());
- // iterate over the declared RowMappers and register the corresponding SqlParameter
+ // Iterate over the declared RowMappers and register the corresponding SqlParameter
for (Map.Entry<String, RowMapper> entry : this.declaredRowMappers.entrySet()) {
SqlParameter resultSetParameter =
this.callMetaDataContext.createReturnResultSetParameter(entry.getKey(), entry.getValue());
@@ -341,7 +347,7 @@ public abstract class AbstractJdbcCall {
//-------------------------------------------------------------------------
/**
- * Method that provides execution of the call using the passed in {@link SqlParameterSource}
+ * Delegate method that executes the call using the passed-in {@link SqlParameterSource}.
* @param parameterSource parameter names and values to be used in call
* @return Map of out parameters
*/
@@ -352,18 +358,19 @@ public abstract class AbstractJdbcCall {
}
/**
- * Method that provides execution of the call using the passed in array of parameters
- * @param args array of parameter values; order must match the order declared for the stored procedure
+ * Delegate method that executes the call using the passed-in array of parameters.
+ * @param args array of parameter values. The order of values must match the order
+ * declared for the stored procedure.
* @return Map of out parameters
*/
- protected Map<String, Object> doExecute(Object[] args) {
+ protected Map<String, Object> doExecute(Object... args) {
checkCompiled();
Map<String, ?> params = matchInParameterValuesWithCallParameters(args);
return executeCallInternal(params);
}
/**
- * Method that provides execution of the call using the passed in Map of parameters
+ * Delegate method that executes the call using the passed-in Map of parameters.
* @param args Map of parameter name and values
* @return Map of out parameters
*/
@@ -374,7 +381,7 @@ public abstract class AbstractJdbcCall {
}
/**
- * Method to perform the actual call processing
+ * Delegate method to perform the actual call processing.
*/
private Map<String, Object> executeCallInternal(Map<String, ?> args) {
CallableStatementCreator csc = getCallableStatementFactory().newCallableStatementCreator(args);
@@ -400,8 +407,8 @@ public abstract class AbstractJdbcCall {
}
/**
- * Get a List of all the call parameters to be used for call. This includes any parameters added
- * based on meta data processing.
+ * Get a List of all the call parameters to be used for call.
+ * This includes any parameters added based on meta data processing.
*/
protected List<SqlParameter> getCallParameters() {
return this.callMetaDataContext.getCallParameters();
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java
index 055b86f3..e71129b1 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java
@@ -78,8 +78,7 @@ public abstract class AbstractJdbcInsert {
/**
* Has this operation been compiled? Compilation means at least checking
- * that a DataSource or JdbcTemplate has been provided, but subclasses
- * may also implement their own custom validation.
+ * that a DataSource or JdbcTemplate has been provided.
*/
private boolean compiled = false;
@@ -91,14 +90,16 @@ public abstract class AbstractJdbcInsert {
/**
- * Constructor for sublasses to delegate to for setting the DataSource.
+ * Constructor to be used when initializing using a {@link DataSource}.
+ * @param dataSource the DataSource to be used
*/
protected AbstractJdbcInsert(DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
/**
- * Constructor for sublasses to delegate to for setting the JdbcTemplate.
+ * Constructor to be used when initializing using a {@link JdbcTemplate}.
+ * @param jdbcTemplate the JdbcTemplate to use
*/
protected AbstractJdbcInsert(JdbcTemplate jdbcTemplate) {
Assert.notNull(jdbcTemplate, "JdbcTemplate must not be null");
@@ -112,7 +113,7 @@ public abstract class AbstractJdbcInsert {
//-------------------------------------------------------------------------
/**
- * Get the {@link JdbcTemplate} that is configured to be used.
+ * Get the configured {@link JdbcTemplate}.
*/
public JdbcTemplate getJdbcTemplate() {
return this.jdbcTemplate;
@@ -271,8 +272,9 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method to perform the actual compilation. Subclasses can override this template method
- * to perform their own compilation. Invoked after this base class's compilation is complete.
+ * Delegate method to perform the actual compilation.
+ * <p>Subclasses can override this template method to perform their own compilation.
+ * Invoked after this base class's compilation is complete.
*/
protected void compileInternal() {
this.tableMetaDataContext.processMetaData(
@@ -287,7 +289,7 @@ public abstract class AbstractJdbcInsert {
/**
* Hook method that subclasses may override to react to compilation.
- * This implementation does nothing.
+ * <p>This implementation is empty.
*/
protected void onCompileInternal() {
}
@@ -329,9 +331,9 @@ public abstract class AbstractJdbcInsert {
//-------------------------------------------------------------------------
/**
- * Method that provides execution of the insert using the passed in Map of parameters
+ * Delegate method that executes the insert using the passed-in Map of parameters.
* @param args Map with parameter names and values to be used in insert
- * @return number of rows affected
+ * @return the number of rows affected
*/
protected int doExecute(Map<String, Object> args) {
checkCompiled();
@@ -340,9 +342,9 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method that provides execution of the insert using the passed in {@link SqlParameterSource}
+ * Delegate method that executes the insert using the passed-in {@link SqlParameterSource}.
* @param parameterSource parameter names and values to be used in insert
- * @return number of rows affected
+ * @return the number of rows affected
*/
protected int doExecute(SqlParameterSource parameterSource) {
checkCompiled();
@@ -351,7 +353,7 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method to execute the insert.
+ * Delegate method to execute the insert.
*/
private int executeInsertInternal(List<Object> values) {
if (logger.isDebugEnabled()) {
@@ -361,9 +363,8 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method that provides execution of the insert using the passed in Map of parameters
- * and returning a generated key
- *
+ * Method that provides execution of the insert using the passed-in
+ * Map of parameters and returning a generated key.
* @param args Map with parameter names and values to be used in insert
* @return the key generated by the insert
*/
@@ -374,9 +375,8 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method that provides execution of the insert using the passed in {@link SqlParameterSource}
- * and returning a generated key
- *
+ * Method that provides execution of the insert using the passed-in
+ * {@link SqlParameterSource} and returning a generated key.
* @param parameterSource parameter names and values to be used in insert
* @return the key generated by the insert
*/
@@ -387,9 +387,8 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method that provides execution of the insert using the passed in Map of parameters
- * and returning all generated keys
- *
+ * Method that provides execution of the insert using the passed-in
+ * Map of parameters and returning all generated keys.
* @param args Map with parameter names and values to be used in insert
* @return the KeyHolder containing keys generated by the insert
*/
@@ -400,9 +399,8 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method that provides execution of the insert using the passed in {@link SqlParameterSource}
- * and returning all generated keys
- *
+ * Method that provides execution of the insert using the passed-in
+ * {@link SqlParameterSource} and returning all generated keys.
* @param parameterSource parameter names and values to be used in insert
* @return the KeyHolder containing keys generated by the insert
*/
@@ -413,7 +411,7 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method to execute the insert generating single key
+ * Delegate method to execute the insert, generating a single key.
*/
private Number executeInsertAndReturnKeyInternal(final List<Object> values) {
KeyHolder kh = executeInsertAndReturnKeyHolderInternal(values);
@@ -427,7 +425,7 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method to execute the insert generating any number of keys
+ * Delegate method to execute the insert, generating any number of keys.
*/
private KeyHolder executeInsertAndReturnKeyHolderInternal(final List<Object> values) {
if (logger.isDebugEnabled()) {
@@ -512,16 +510,14 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Create the PreparedStatement to be used for insert that have generated keys
- *
- * @param con the connection used
- * @return PreparedStatement to use
- * @throws SQLException
+ * Create a PreparedStatement to be used for an insert operation with generated keys.
+ * @param con the Connection to use
+ * @return the PreparedStatement
*/
private PreparedStatement prepareStatementForGeneratedKeys(Connection con) throws SQLException {
if (getGeneratedKeyNames().length < 1) {
- throw new InvalidDataAccessApiUsageException("Generated Key Name(s) not specificed. " +
- "Using the generated keys features requires specifying the name(s) of the generated column(s)");
+ throw new InvalidDataAccessApiUsageException("Generated Key Name(s) not specified. " +
+ "Using the generated keys features requires specifying the name(s) of the generated column(s).");
}
PreparedStatement ps;
if (this.tableMetaDataContext.isGeneratedKeysColumnNameArraySupported()) {
@@ -540,11 +536,11 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method that provides execution of a batch insert using the passed in Maps of parameters.
+ * Delegate method that executes a batch insert using the passed-in Maps of parameters.
* @param batch array of Maps with parameter names and values to be used in batch insert
* @return array of number of rows affected
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"unchecked", "rawtypes"})
protected int[] doExecuteBatch(Map<String, Object>[] batch) {
checkCompiled();
List[] batchValues = new ArrayList[batch.length];
@@ -557,11 +553,11 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method that provides execution of a batch insert using the passed in array of {@link SqlParameterSource}
+ * Delegate method that executes a batch insert using the passed-in {@link SqlParameterSource}s.
* @param batch array of SqlParameterSource with parameter names and values to be used in insert
* @return array of number of rows affected
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({"unchecked", "rawtypes"})
protected int[] doExecuteBatch(SqlParameterSource[] batch) {
checkCompiled();
List[] batchValues = new ArrayList[batch.length];
@@ -574,7 +570,7 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Method to execute the batch insert.
+ * Delegate method to execute the batch insert.
*/
private int[] executeBatchInternal(final List<Object>[] batchValues) {
if (logger.isDebugEnabled()) {
@@ -613,8 +609,8 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Match the provided in parameter values with registered parameters and parameters defined
- * via metadata processing.
+ * Match the provided in parameter values with registered parameters and parameters
+ * defined via metadata processing.
* @param parameterSource the parameter values provided as a {@link SqlParameterSource}
* @return Map with parameter names and values
*/
@@ -623,8 +619,8 @@ public abstract class AbstractJdbcInsert {
}
/**
- * Match the provided in parameter values with regitered parameters and parameters defined
- * via metadata processing.
+ * Match the provided in parameter values with registered parameters and parameters
+ * defined via metadata processing.
* @param args the parameter values provided in a Map
* @return Map with parameter names and values
*/
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java
index 7e7098c8..64368f4a 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCall.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@
package org.springframework.jdbc.core.simple;
import java.util.Arrays;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Map;
import javax.sql.DataSource;
@@ -116,7 +116,7 @@ public class SimpleJdbcCall extends AbstractJdbcCall implements SimpleJdbcCallOp
}
public SimpleJdbcCall useInParameterNames(String... inParameterNames) {
- setInParameterNames(new HashSet<String>(Arrays.asList(inParameterNames)));
+ setInParameterNames(new LinkedHashSet<String>(Arrays.asList(inParameterNames)));
return this;
}
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java
index cac760a9..0cd4307d 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcCallOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,8 +24,8 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource;
/**
* Interface specifying the API for a Simple JDBC Call implemented by {@link SimpleJdbcCall}.
- * This interface is not often used directly, but provides the
- * option to enhance testability, as it can easily be mocked or stubbed.
+ * This interface is not often used directly, but provides the option to enhance testability,
+ * as it can easily be mocked or stubbed.
*
* @author Thomas Risberg
* @since 2.5
@@ -55,8 +55,8 @@ public interface SimpleJdbcCallOperations {
/**
* Optionally, specify the name of the catalog that contins the stored procedure.
- * To provide consistency with the Oracle DatabaseMetaData, this is used to specify the package name if
- * the procedure is declared as part of a package.
+ * <p>To provide consistency with the Oracle DatabaseMetaData, this is used to specify the
+ * package name if the procedure is declared as part of a package.
* @param catalogName the catalog or package name
* @return the instance of this SimpleJdbcCall
*/
@@ -69,12 +69,12 @@ public interface SimpleJdbcCallOperations {
SimpleJdbcCallOperations withReturnValue();
/**
- * 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} 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}.
+ * Specify one or more parameters if desired. These parameters will be supplemented with
+ * any parameter information retrieved from the database meta data.
+ * <p>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}.
* @param sqlParameters the parameters to use
* @return the instance of this SimpleJdbcCall
*/
@@ -84,11 +84,11 @@ public interface SimpleJdbcCallOperations {
SimpleJdbcCallOperations useInParameterNames(String... inParameterNames);
/**
- * Used to specify when a ResultSet is returned by the stored procedure and you want it mapped
- * by a RowMapper. The results will be returned using the parameter name specified. Multiple
- * ResultSets must be declared in the correct order. If the database you are using uses ref cursors
- * then the name specified must match the name of the parameter declared for the procedure in the
- * database.
+ * Used to specify when a ResultSet is returned by the stored procedure and you want it
+ * mapped by a {@link RowMapper}. The results will be returned using the parameter name
+ * specified. Multiple ResultSets must be declared in the correct order.
+ * <p>If the database you are using uses ref cursors then the name specified must match
+ * the name of the parameter declared for the procedure in the database.
* @param parameterName the name of the returned results and/or the name of the ref cursor parameter
* @param rowMapper the RowMapper implementation that will map the data returned for each row
* */
@@ -113,7 +113,8 @@ public interface SimpleJdbcCallOperations {
/**
- * Execute the stored function and return the results obtained as an Object of the specified return type.
+ * Execute the stored function and return the results obtained as an Object of the
+ * specified return type.
* @param returnType the type of the value to return
* @param args optional array containing the in parameter values to be used in the call.
* Parameter values must be provided in the same order as the parameters are defined
@@ -122,66 +123,73 @@ public interface SimpleJdbcCallOperations {
<T> T executeFunction(Class<T> returnType, Object... args);
/**
- * Execute the stored function and return the results obtained as an Object of the specified return type.
+ * Execute the stored function and return the results obtained as an Object of the
+ * specified return type.
* @param returnType the type of the value to return
- * @param args Map containing the parameter values to be used in the call.
+ * @param args Map containing the parameter values to be used in the call
*/
<T> T executeFunction(Class<T> returnType, Map<String, ?> args);
/**
- * Execute the stored function and return the results obtained as an Object of the specified return type.
+ * Execute the stored function and return the results obtained as an Object of the
+ * specified return type.
* @param returnType the type of the value to return
- * @param args MapSqlParameterSource containing the parameter values to be used in the call.
+ * @param args MapSqlParameterSource containing the parameter values to be used in the call
*/
<T> T executeFunction(Class<T> returnType, SqlParameterSource args);
/**
- * Execute the stored procedure and return the single out parameter as an Object of the specified return type.
- * In the case where there are multiple out parameters, the first one is returned and additional out parameters
- * are ignored.
+ * Execute the stored procedure and return the single out parameter as an Object
+ * of the specified return type. In the case where there are multiple out parameters,
+ * the first one is returned and additional out parameters are ignored.
* @param returnType the type of the value to return
- * @param args optional array containing the in parameter values to be used in the call. Parameter values must
- * be provided in the same order as the parameters are defined for the stored procedure.
+ * @param args optional array containing the in parameter values to be used in the call.
+ * Parameter values must be provided in the same order as the parameters are defined for
+ * the stored procedure.
*/
<T> T executeObject(Class<T> returnType, Object... args);
/**
- * Execute the stored procedure and return the single out parameter as an Object of the specified return type.
- * In the case where there are multiple out parameters, the first one is returned and additional out parameters
- * are ignored.
+ * Execute the stored procedure and return the single out parameter as an Object
+ * of the specified return type. In the case where there are multiple out parameters,
+ * the first one is returned and additional out parameters are ignored.
* @param returnType the type of the value to return
- * @param args Map containing the parameter values to be used in the call.
+ * @param args Map containing the parameter values to be used in the call
*/
<T> T executeObject(Class<T> returnType, Map<String, ?> args);
/**
- * Execute the stored procedure and return the single out parameter as an Object of the specified return type.
- * In the case where there are multiple out parameters, the first one is returned and additional out parameters
- * are ignored.
+ * Execute the stored procedure and return the single out parameter as an Object
+ * of the specified return type. In the case where there are multiple out parameters,
+ * the first one is returned and additional out parameters are ignored.
* @param returnType the type of the value to return
- * @param args MapSqlParameterSource containing the parameter values to be used in the call.
+ * @param args MapSqlParameterSource containing the parameter values to be used in the call
*/
<T> T executeObject(Class<T> returnType, SqlParameterSource args);
/**
- * Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations.
- * @param args optional array containing the in parameter values to be used in the call. Parameter values must
- * be provided in the same order as the parameters are defined for the stored procedure.
- * @return map of output params.
+ * Execute the stored procedure and return a map of output params, keyed by name
+ * as in parameter declarations.
+ * @param args optional array containing the in parameter values to be used in the call.
+ * Parameter values must be provided in the same order as the parameters are defined for
+ * the stored procedure.
+ * @return Map of output params
*/
Map<String, Object> execute(Object... args);
/**
- * Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations..
- * @param args Map containing the parameter values to be used in the call.
- * @return map of output params.
+ * Execute the stored procedure and return a map of output params, keyed by name
+ * as in parameter declarations.
+ * @param args Map containing the parameter values to be used in the call
+ * @return Map of output params
*/
Map<String, Object> execute(Map<String, ?> args);
/**
- * Execute the stored procedure and return a map of output params, keyed by name as in parameter declarations..
- * @param args SqlParameterSource containing the parameter values to be used in the call.
- * @return map of output params.
+ * Execute the stored procedure and return a map of output params, keyed by name
+ * as in parameter declarations.
+ * @param args SqlParameterSource containing the parameter values to be used in the call
+ * @return Map of output params
*/
Map<String, Object> execute(SqlParameterSource args);
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsert.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsert.java
index b802fbe4..ba6d109a 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsert.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsert.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ package org.springframework.jdbc.core.simple;
import java.util.Arrays;
import java.util.Map;
-
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java
index 30950b72..c3bb41cb 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/SimpleJdbcInsertOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,8 +24,8 @@ import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor;
/**
* Interface specifying the API for a Simple JDBC Insert implemented by {@link SimpleJdbcInsert}.
- * This interface is not often used directly, but provides the
- * option to enhance testability, as it can easily be mocked or stubbed.
+ * This interface is not often used directly, but provides the option to enhance testability,
+ * as it can easily be mocked or stubbed.
*
* @author Thomas Risberg
* @since 2.5
@@ -40,7 +40,7 @@ public interface SimpleJdbcInsertOperations {
SimpleJdbcInsertOperations withTableName(String tableName);
/**
- * Specify the shema name, if any, to be used for the insert.
+ * Specify the schema name, if any, to be used for the insert.
* @param schemaName the name of the schema
* @return the instance of this SimpleJdbcInsert
*/
@@ -61,7 +61,7 @@ public interface SimpleJdbcInsertOperations {
SimpleJdbcInsertOperations usingColumns(String... columnNames);
/**
- * Specify the name sof any columns that have auto generated keys.
+ * Specify the names of any columns that have auto generated keys.
* @param columnNames one or more column names
* @return the instance of this SimpleJdbcInsert
*/
@@ -108,36 +108,40 @@ public interface SimpleJdbcInsertOperations {
int execute(SqlParameterSource parameterSource);
/**
- * Execute the insert using the values passed in and return the generated key. This requires that
- * the name of the columns with auto generated keys have been specified. This method will always
- * return a key or throw an exception if a key was not returned.
+ * Execute the insert using the values passed in and return the generated key.
+ * <p>This requires that the name of the columns with auto generated keys have been specified.
+ * This method will always return a KeyHolder but the caller must verify that it actually
+ * contains the generated keys.
* @param args Map containing column names and corresponding value
* @return the generated key value
*/
Number executeAndReturnKey(Map<String, Object> args);
/**
- * Execute the insert using the values passed in and return the generated key. This requires that
- * the name of the columns with auto generated keys have been specified. This method will always
- * return a key or throw an exception if a key was not returned.
+ * Execute the insert using the values passed in and return the generated key.
+ * <p>This requires that the name of the columns with auto generated keys have been specified.
+ * This method will always return a KeyHolder but the caller must verify that it actually
+ * contains the generated keys.
* @param parameterSource SqlParameterSource containing values to use for insert
* @return the generated key value.
*/
Number executeAndReturnKey(SqlParameterSource parameterSource);
/**
- * Execute the insert using the values passed in and return the generated keys. This requires that
- * the name of the columns with auto generated keys have been specified. This method will always return
- * a KeyHolder but the caller must verify that it actually contains the generated keys.
+ * Execute the insert using the values passed in and return the generated keys.
+ * <p>This requires that the name of the columns with auto generated keys have been specified.
+ * This method will always return a KeyHolder but the caller must verify that it actually
+ * contains the generated keys.
* @param args Map containing column names and corresponding value
* @return the KeyHolder containing all generated keys
*/
KeyHolder executeAndReturnKeyHolder(Map<String, Object> args);
/**
- * Execute the insert using the values passed in and return the generated keys. This requires that
- * the name of the columns with auto generated keys have been specified. This method will always return
- * a KeyHolder but the caller must verify that it actually contains the generated keys.
+ * Execute the insert using the values passed in and return the generated keys.
+ * <p>This requires that the name of the columns with auto generated keys have been specified.
+ * This method will always return a KeyHolder but the caller must verify that it actually
+ * contains the generated keys.
* @param parameterSource SqlParameterSource containing values to use for insert
* @return the KeyHolder containing all generated keys
*/
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java
index 05fad271..bb745d11 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/DerbyEmbeddedDatabaseConfigurer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,11 +43,6 @@ final class DerbyEmbeddedDatabaseConfigurer implements EmbeddedDatabaseConfigure
// Error code that indicates successful shutdown
private static final String SHUTDOWN_CODE = "08006";
- private static final boolean IS_AT_LEAST_DOT_SIX = new EmbeddedDriver().getMinorVersion() >= 6;
-
- private static final String SHUTDOWN_COMMAND =
- String.format("%s=true", IS_AT_LEAST_DOT_SIX ? "drop" : "shutdown");
-
private static DerbyEmbeddedDatabaseConfigurer INSTANCE;
@@ -77,16 +72,19 @@ final class DerbyEmbeddedDatabaseConfigurer implements EmbeddedDatabaseConfigure
}
public void shutdown(DataSource dataSource, String databaseName) {
+ EmbeddedDriver embeddedDriver = new EmbeddedDriver();
+ boolean isAtLeastDotSix = (embeddedDriver.getMinorVersion() >= 6);
+ String shutdownCommand = String.format("%s=true", isAtLeastDotSix ? "drop" : "shutdown");
try {
- new EmbeddedDriver().connect(
- String.format(URL_TEMPLATE, databaseName, SHUTDOWN_COMMAND), new Properties());
+ embeddedDriver.connect(
+ String.format(URL_TEMPLATE, databaseName, shutdownCommand), new Properties());
}
catch (SQLException ex) {
if (!SHUTDOWN_CODE.equals(ex.getSQLState())) {
logger.warn("Could not shutdown in-memory Derby database", ex);
return;
}
- if (!IS_AT_LEAST_DOT_SIX) {
+ if (!isAtLeastDotSix) {
// Explicitly purge the in-memory database, to prevent it
// from hanging around after being shut down.
try {
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java
index 514ea9b7..83fb15c1 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSet.java
@@ -31,12 +31,11 @@ import java.util.Map;
import org.springframework.jdbc.InvalidResultSetAccessException;
/**
- * Default implementation of Spring's {@link SqlRowSet} interface.
+ * The default implementation of Spring's {@link SqlRowSet} interface, wrapping a
+ * {@link java.sql.ResultSet}, catching any {@link SQLException}s and translating
+ * them to a corresponding Spring {@link InvalidResultSetAccessException}.
*
- * <p>This implementation wraps a {@code javax.sql.ResultSet}, catching any SQLExceptions
- * and translating them to the appropriate Spring {@link InvalidResultSetAccessException}.
- *
- * <p>The passed-in ResultSets should already be disconnected if the SqlRowSet is supposed
+ * <p>The passed-in ResultSet should already be disconnected if the SqlRowSet is supposed
* to be usable in a disconnected fashion. This means that you will usually pass in a
* {@code javax.sql.rowset.CachedRowSet}, which implements the ResultSet interface.
*
@@ -213,11 +212,11 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getDate(int, java.util.Calendar)
+ * @see java.sql.ResultSet#getDate(int)
*/
- public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
+ public Date getDate(int columnIndex) throws InvalidResultSetAccessException {
try {
- return this.resultSet.getDate(columnIndex, cal);
+ return this.resultSet.getDate(columnIndex);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
@@ -225,31 +224,32 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getDate(int)
+ * @see java.sql.ResultSet#getDate(String)
*/
- public Date getDate(int columnIndex) throws InvalidResultSetAccessException {
+ public Date getDate(String columnLabel) throws InvalidResultSetAccessException {
+ return getDate(findColumn(columnLabel));
+ }
+
+ /**
+ * @see java.sql.ResultSet#getDate(int, Calendar)
+ */
+ public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try {
- return this.resultSet.getDate(columnIndex);
+ return this.resultSet.getDate(columnIndex, cal);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
}
}
+
/**
- * @see java.sql.ResultSet#getDate(String, java.util.Calendar)
+ * @see java.sql.ResultSet#getDate(String, Calendar)
*/
public Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
return getDate(findColumn(columnLabel), cal);
}
/**
- * @see java.sql.ResultSet#getDate(String)
- */
- public Date getDate(String columnLabel) throws InvalidResultSetAccessException {
- return getDate(findColumn(columnLabel));
- }
-
- /**
* @see java.sql.ResultSet#getDouble(int)
*/
public double getDouble(int columnIndex) throws InvalidResultSetAccessException {
@@ -286,6 +286,7 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
public float getFloat(String columnLabel) throws InvalidResultSetAccessException {
return getFloat(findColumn(columnLabel));
}
+
/**
* @see java.sql.ResultSet#getInt(int)
*/
@@ -325,11 +326,11 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getObject(int, java.util.Map)
+ * @see java.sql.ResultSet#getObject(int)
*/
- public Object getObject(int i, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
+ public Object getObject(int columnIndex) throws InvalidResultSetAccessException {
try {
- return this.resultSet.getObject(i, map);
+ return this.resultSet.getObject(columnIndex);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
@@ -337,11 +338,18 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getObject(int)
+ * @see java.sql.ResultSet#getObject(String)
*/
- public Object getObject(int columnIndex) throws InvalidResultSetAccessException {
+ public Object getObject(String columnLabel) throws InvalidResultSetAccessException {
+ return getObject(findColumn(columnLabel));
+ }
+
+ /**
+ * @see java.sql.ResultSet#getObject(int, Map)
+ */
+ public Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
try {
- return this.resultSet.getObject(columnIndex);
+ return this.resultSet.getObject(columnIndex, map);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
@@ -349,20 +357,13 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getObject(String, java.util.Map)
+ * @see java.sql.ResultSet#getObject(String, Map)
*/
- public Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
+ public Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
return getObject(findColumn(columnLabel), map);
}
/**
- * @see java.sql.ResultSet#getObject(String)
- */
- public Object getObject(String columnLabel) throws InvalidResultSetAccessException {
- return getObject(findColumn(columnLabel));
- }
-
- /**
* @see java.sql.ResultSet#getShort(int)
*/
public short getShort(int columnIndex) throws InvalidResultSetAccessException {
@@ -401,18 +402,6 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getTime(int, java.util.Calendar)
- */
- public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
- try {
- return this.resultSet.getTime(columnIndex, cal);
- }
- catch (SQLException se) {
- throw new InvalidResultSetAccessException(se);
- }
- }
-
- /**
* @see java.sql.ResultSet#getTime(int)
*/
public Time getTime(int columnIndex) throws InvalidResultSetAccessException {
@@ -425,13 +414,6 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getTime(String, java.util.Calendar)
- */
- public Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
- return getTime(findColumn(columnLabel), cal);
- }
-
- /**
* @see java.sql.ResultSet#getTime(String)
*/
public Time getTime(String columnLabel) throws InvalidResultSetAccessException {
@@ -439,11 +421,11 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
+ * @see java.sql.ResultSet#getTime(int, Calendar)
*/
- public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
+ public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
try {
- return this.resultSet.getTimestamp(columnIndex, cal);
+ return this.resultSet.getTime(columnIndex, cal);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
@@ -451,6 +433,13 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
+ * @see java.sql.ResultSet#getTime(String, Calendar)
+ */
+ public Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
+ return getTime(findColumn(columnLabel), cal);
+ }
+
+ /**
* @see java.sql.ResultSet#getTimestamp(int)
*/
public Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException {
@@ -463,17 +452,29 @@ public class ResultSetWrappingSqlRowSet implements SqlRowSet {
}
/**
- * @see java.sql.ResultSet#getTimestamp(String, java.util.Calendar)
+ * @see java.sql.ResultSet#getTimestamp(String)
*/
- public Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
- return getTimestamp(findColumn(columnLabel), cal);
+ public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException {
+ return getTimestamp(findColumn(columnLabel));
}
/**
- * @see java.sql.ResultSet#getTimestamp(String)
+ * @see java.sql.ResultSet#getTimestamp(int, Calendar)
*/
- public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException {
- return getTimestamp(findColumn(columnLabel));
+ public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
+ try {
+ return this.resultSet.getTimestamp(columnIndex, cal);
+ }
+ catch (SQLException se) {
+ throw new InvalidResultSetAccessException(se);
+ }
+ }
+
+ /**
+ * @see java.sql.ResultSet#getTimestamp(String, Calendar)
+ */
+ public Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
+ return getTimestamp(findColumn(columnLabel), cal);
}
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java
index 31d9d9e1..ababa338 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/ResultSetWrappingSqlRowSetMetaData.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,17 +22,16 @@ import java.sql.SQLException;
import org.springframework.jdbc.InvalidResultSetAccessException;
/**
- * Default implementation of Spring's SqlRowSetMetaData interface.
- * Used by ResultSetWrappingSqlRowSet.
+ * The default implementation of Spring's {@link SqlRowSetMetaData} interface, wrapping
+ * a {@link java.sql.ResultSetMetaData} instance, catching any {@link SQLException}s
+ * and translating them to a corresponding Spring {@link InvalidResultSetAccessException}.
*
- * <p>This implementation wraps a {@code javax.sql.ResultSetMetaData}
- * instance, catching any SQLExceptions and translating them to the
- * appropriate Spring DataAccessException.
+ * <p>Used by {@link ResultSetWrappingSqlRowSet}.
*
* @author Thomas Risberg
* @author Juergen Hoeller
* @since 1.2
- * @see ResultSetWrappingSqlRowSet#getMetaData
+ * @see ResultSetWrappingSqlRowSet#getMetaData()
*/
public class ResultSetWrappingSqlRowSetMetaData implements SqlRowSetMetaData {
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java
index 88900de9..eca73405 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSet.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,17 +27,17 @@ import java.util.Map;
import org.springframework.jdbc.InvalidResultSetAccessException;
/**
- * Mirror interface for {@code javax.sql.RowSet}, representing
- * disconnected {@code java.sql.ResultSet} data.
+ * Mirror interface for {@link javax.sql.RowSet}, representing
+ * disconnected {@link java.sql.ResultSet} data.
*
- * <p>The main difference to the standard JDBC RowSet is that an SQLException
- * is never thrown here. This allows a SqlRowSet to be used without having
- * to deal with checked exceptions. A SqlRowSet will throw Spring's
- * {@code org.springframework.jdbc.InvalidResultSetAccessException}
+ * <p>The main difference to the standard JDBC RowSet is that a
+ * {@link java.sql.SQLException} is never thrown here. This allows a
+ * SqlRowSet to be used without having to deal with checked exceptions.
+ * A SqlRowSet will throw Spring's {@link InvalidResultSetAccessException}
* instead (when appropriate).
*
- * <p>Note: This interface extends the {@code java.io.Serializable}
- * marker interface. Implementations, which typically hold disconnected data,
+ * <p>Note: This interface extends the {@code java.io.Serializable} marker
+ * interface. Implementations, which typically hold disconnected data,
* are encouraged to be actually serializable (as far as possible).
*
* @author Thomas Risberg
@@ -51,15 +51,15 @@ import org.springframework.jdbc.InvalidResultSetAccessException;
public interface SqlRowSet extends Serializable {
/**
- * Retrieves the meta data (number, types and properties for the columns)
- * of this row set.
+ * Retrieve the meta data, i.e. number, types and properties
+ * for the columns of this row set.
* @return a corresponding SqlRowSetMetaData instance
* @see java.sql.ResultSet#getMetaData()
*/
SqlRowSetMetaData getMetaData();
/**
- * Maps the given column label to its column index.
+ * Map the given column label to its column index.
* @param columnLabel the name of the column
* @return the column index for the given column label
* @see java.sql.ResultSet#findColumn(String)
@@ -70,8 +70,8 @@ public interface SqlRowSet extends Serializable {
// RowSet methods for extracting data values
/**
- * Retrieves the value of the indicated column in the current row as
- * an BigDecimal object.
+ * Retrieve the value of the indicated column in the current row
+ * as a BigDecimal object.
* @param columnIndex the column index
* @return an BigDecimal object representing the column value
* @see java.sql.ResultSet#getBigDecimal(int)
@@ -79,17 +79,17 @@ public interface SqlRowSet extends Serializable {
BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * an BigDecimal object.
+ * Retrieve the value of the indicated column in the current row
+ * as a BigDecimal object.
* @param columnLabel the column label
* @return an BigDecimal object representing the column value
- * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
+ * @see java.sql.ResultSet#getBigDecimal(String)
*/
BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a boolean.
+ * Retrieve the value of the indicated column in the current row
+ * as a boolean.
* @param columnIndex the column index
* @return a boolean representing the column value
* @see java.sql.ResultSet#getBoolean(int)
@@ -97,17 +97,17 @@ public interface SqlRowSet extends Serializable {
boolean getBoolean(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a boolean.
+ * Retrieve the value of the indicated column in the current row
+ * as a boolean.
* @param columnLabel the column label
* @return a boolean representing the column value
- * @see java.sql.ResultSet#getBoolean(java.lang.String)
+ * @see java.sql.ResultSet#getBoolean(String)
*/
boolean getBoolean(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a byte.
+ * Retrieve the value of the indicated column in the current row
+ * as a byte.
* @param columnIndex the column index
* @return a byte representing the column value
* @see java.sql.ResultSet#getByte(int)
@@ -115,55 +115,55 @@ public interface SqlRowSet extends Serializable {
byte getByte(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a byte.
+ * Retrieve the value of the indicated column in the current row
+ * as a byte.
* @param columnLabel the column label
* @return a byte representing the column value
- * @see java.sql.ResultSet#getByte(java.lang.String)
+ * @see java.sql.ResultSet#getByte(String)
*/
byte getByte(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Date object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Date object.
* @param columnIndex the column index
- * @param cal the Calendar to use in constructing the Date
* @return a Date object representing the column value
- * @see java.sql.ResultSet#getDate(int, java.util.Calendar)
+ * @see java.sql.ResultSet#getDate(int)
*/
- Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
+ Date getDate(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Date object.
- * @param columnIndex the column index
+ * Retrieve the value of the indicated column in the current row
+ * as a Date object.
+ * @param columnLabel the column label
* @return a Date object representing the column value
- * @see java.sql.ResultSet#getDate(int)
+ * @see java.sql.ResultSet#getDate(String)
*/
- Date getDate(int columnIndex) throws InvalidResultSetAccessException;
+ Date getDate(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Date object.
- * @param columnLabel the column label
+ * Retrieve the value of the indicated column in the current row
+ * as a Date object.
+ * @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date
* @return a Date object representing the column value
- * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar)
+ * @see java.sql.ResultSet#getDate(int, Calendar)
*/
- Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
+ Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Date object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Date object.
* @param columnLabel the column label
+ * @param cal the Calendar to use in constructing the Date
* @return a Date object representing the column value
- * @see java.sql.ResultSet#getDate(java.lang.String)
+ * @see java.sql.ResultSet#getDate(String, Calendar)
*/
- Date getDate(String columnLabel) throws InvalidResultSetAccessException;
+ Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Double object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Double object.
* @param columnIndex the column index
* @return a Double object representing the column value
* @see java.sql.ResultSet#getDouble(int)
@@ -171,17 +171,17 @@ public interface SqlRowSet extends Serializable {
double getDouble(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Double object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Double object.
* @param columnLabel the column label
* @return a Double object representing the column value
- * @see java.sql.ResultSet#getDouble(java.lang.String)
+ * @see java.sql.ResultSet#getDouble(String)
*/
double getDouble(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a float.
+ * Retrieve the value of the indicated column in the current row
+ * as a float.
* @param columnIndex the column index
* @return a float representing the column value
* @see java.sql.ResultSet#getFloat(int)
@@ -189,17 +189,17 @@ public interface SqlRowSet extends Serializable {
float getFloat(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a float.
+ * Retrieve the value of the indicated column in the current row
+ * as a float.
* @param columnLabel the column label
* @return a float representing the column value
- * @see java.sql.ResultSet#getFloat(java.lang.String)
+ * @see java.sql.ResultSet#getFloat(String)
*/
float getFloat(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * an int.
+ * Retrieve the value of the indicated column in the current row
+ * as an int.
* @param columnIndex the column index
* @return an int representing the column value
* @see java.sql.ResultSet#getInt(int)
@@ -207,17 +207,17 @@ public interface SqlRowSet extends Serializable {
int getInt(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * an int.
+ * Retrieve the value of the indicated column in the current row
+ * as an int.
* @param columnLabel the column label
* @return an int representing the column value
- * @see java.sql.ResultSet#getInt(java.lang.String)
+ * @see java.sql.ResultSet#getInt(String)
*/
int getInt(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a long.
+ * Retrieve the value of the indicated column in the current row
+ * as a long.
* @param columnIndex the column index
* @return a long representing the column value
* @see java.sql.ResultSet#getLong(int)
@@ -225,55 +225,55 @@ public interface SqlRowSet extends Serializable {
long getLong(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a long.
+ * Retrieve the value of the indicated column in the current row
+ * as a long.
* @param columnLabel the column label
* @return a long representing the column value
- * @see java.sql.ResultSet#getLong(java.lang.String)
+ * @see java.sql.ResultSet#getLong(String)
*/
long getLong(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * an Object.
+ * Retrieve the value of the indicated column in the current row
+ * as an Object.
* @param columnIndex the column index
- * @param map a Map object containing the mapping from SQL types to Java types
* @return a Object representing the column value
- * @see java.sql.ResultSet#getObject(int, java.util.Map)
+ * @see java.sql.ResultSet#getObject(int)
*/
- Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
+ Object getObject(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * an Object.
- * @param columnIndex the column index
+ * Retrieve the value of the indicated column in the current row
+ * as an Object.
+ * @param columnLabel the column label
* @return a Object representing the column value
- * @see java.sql.ResultSet#getObject(int)
+ * @see java.sql.ResultSet#getObject(String)
*/
- Object getObject(int columnIndex) throws InvalidResultSetAccessException;
+ Object getObject(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * an Object.
- * @param columnLabel the column label
+ * Retrieve the value of the indicated column in the current row
+ * as an Object.
+ * @param columnIndex the column index
* @param map a Map object containing the mapping from SQL types to Java types
* @return a Object representing the column value
- * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map)
+ * @see java.sql.ResultSet#getObject(int, Map)
*/
- Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
+ Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * an Object.
+ * Retrieve the value of the indicated column in the current row
+ * as an Object.
* @param columnLabel the column label
+ * @param map a Map object containing the mapping from SQL types to Java types
* @return a Object representing the column value
- * @see java.sql.ResultSet#getObject(java.lang.String)
+ * @see java.sql.ResultSet#getObject(String, Map)
*/
- Object getObject(String columnLabel) throws InvalidResultSetAccessException;
+ Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a short.
+ * Retrieve the value of the indicated column in the current row
+ * as a short.
* @param columnIndex the column index
* @return a short representing the column value
* @see java.sql.ResultSet#getShort(int)
@@ -281,17 +281,17 @@ public interface SqlRowSet extends Serializable {
short getShort(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a short.
+ * Retrieve the value of the indicated column in the current row
+ * as a short.
* @param columnLabel the column label
* @return a short representing the column value
- * @see java.sql.ResultSet#getShort(java.lang.String)
+ * @see java.sql.ResultSet#getShort(String)
*/
short getShort(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a String.
+ * Retrieve the value of the indicated column in the current row
+ * as a String.
* @param columnIndex the column index
* @return a String representing the column value
* @see java.sql.ResultSet#getString(int)
@@ -299,27 +299,17 @@ public interface SqlRowSet extends Serializable {
String getString(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a String.
+ * Retrieve the value of the indicated column in the current row
+ * as a String.
* @param columnLabel the column label
* @return a String representing the column value
- * @see java.sql.ResultSet#getString(java.lang.String)
+ * @see java.sql.ResultSet#getString(String)
*/
String getString(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Time object.
- * @param columnIndex the column index
- * @param cal the Calendar to use in constructing the Date
- * @return a Time object representing the column value
- * @see java.sql.ResultSet#getTime(int, java.util.Calendar)
- */
- Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
-
- /**
- * Retrieves the value of the indicated column in the current row as
- * a Time object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Time object.
* @param columnIndex the column index
* @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(int)
@@ -327,37 +317,37 @@ public interface SqlRowSet extends Serializable {
Time getTime(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Time object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Time object.
* @param columnLabel the column label
- * @param cal the Calendar to use in constructing the Date
* @return a Time object representing the column value
- * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
+ * @see java.sql.ResultSet#getTime(String)
*/
- Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
+ Time getTime(String columnLabel) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Time object.
- * @param columnLabel the column label
+ * Retrieve the value of the indicated column in the current row
+ * as a Time object.
+ * @param columnIndex the column index
+ * @param cal the Calendar to use in constructing the Date
* @return a Time object representing the column value
- * @see java.sql.ResultSet#getTime(java.lang.String)
+ * @see java.sql.ResultSet#getTime(int, Calendar)
*/
- Time getTime(String columnLabel) throws InvalidResultSetAccessException;
+ Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Timestamp object.
- * @param columnIndex the column index
+ * Retrieve the value of the indicated column in the current row
+ * as a Time object.
+ * @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date
- * @return a Timestamp object representing the column value
- * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
+ * @return a Time object representing the column value
+ * @see java.sql.ResultSet#getTime(String, Calendar)
*/
- Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
+ Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Timestamp object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Timestamp object.
* @param columnIndex the column index
* @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(int)
@@ -365,123 +355,146 @@ public interface SqlRowSet extends Serializable {
Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Timestamp object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Timestamp object.
* @param columnLabel the column label
+ * @return a Timestamp object representing the column value
+ * @see java.sql.ResultSet#getTimestamp(String)
+ */
+ Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException;
+
+ /**
+ * Retrieve the value of the indicated column in the current row
+ * as a Timestamp object.
+ * @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date
* @return a Timestamp object representing the column value
- * @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar)
+ * @see java.sql.ResultSet#getTimestamp(int, Calendar)
*/
- Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
+ Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/**
- * Retrieves the value of the indicated column in the current row as
- * a Timestamp object.
+ * Retrieve the value of the indicated column in the current row
+ * as a Timestamp object.
* @param columnLabel the column label
+ * @param cal the Calendar to use in constructing the Date
* @return a Timestamp object representing the column value
- * @see java.sql.ResultSet#getTimestamp(java.lang.String)
+ * @see java.sql.ResultSet#getTimestamp(String, Calendar)
*/
- Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException;
+ Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
// RowSet navigation methods
/**
- * Moves the cursor to the given row number in the RowSet, just after the last row.
+ * Move the cursor to the given row number in the row set,
+ * just after the last row.
* @param row the number of the row where the cursor should move
- * @return true if the cursor is on the RowSet, false otherwise
+ * @return {@code true} if the cursor is on the row set,
+ * {@code false} otherwise
* @see java.sql.ResultSet#absolute(int)
*/
boolean absolute(int row) throws InvalidResultSetAccessException;
/**
- * Moves the cursor to the end of this RowSet.
+ * Move the cursor to the end of this row set.
* @see java.sql.ResultSet#afterLast()
*/
void afterLast() throws InvalidResultSetAccessException;
/**
- * Moves the cursor to the front of this RowSet, just before the first row.
+ * Move the cursor to the front of this row set,
+ * just before the first row.
* @see java.sql.ResultSet#beforeFirst()
*/
void beforeFirst() throws InvalidResultSetAccessException;
/**
- * Moves the cursor to the first row of this RowSet.
- * @return true if the cursor is on a valid row, false otherwise
+ * Move the cursor to the first row of this row set.
+ * @return {@code true} if the cursor is on a valid row,
+ * {@code false} otherwise
* @see java.sql.ResultSet#first()
*/
boolean first() throws InvalidResultSetAccessException;
/**
- * Retrieves the current row number.
+ * Retrieve the current row number.
* @return the current row number
* @see java.sql.ResultSet#getRow()
*/
int getRow() throws InvalidResultSetAccessException;
/**
- * Retrieves whether the cursor is after the last row of this RowSet.
- * @return true if the cursor is after the last row, false otherwise
+ * Retrieve whether the cursor is after the last row of this row set.
+ * @return {@code true} if the cursor is after the last row,
+ * {@code false} otherwise
* @see java.sql.ResultSet#isAfterLast()
*/
boolean isAfterLast() throws InvalidResultSetAccessException;
/**
- * Retrieves whether the cursor is after the first row of this RowSet.
- * @return true if the cursor is after the first row, false otherwise
+ * Retrieve whether the cursor is before the first row of this row set.
+ * @return {@code true} if the cursor is before the first row,
+ * {@code false} otherwise
* @see java.sql.ResultSet#isBeforeFirst()
*/
boolean isBeforeFirst() throws InvalidResultSetAccessException;
/**
- * Retrieves whether the cursor is on the first row of this RowSet.
- * @return true if the cursor is after the first row, false otherwise
+ * Retrieve whether the cursor is on the first row of this row set.
+ * @return {@code true} if the cursor is after the first row,
+ * {@code false} otherwise
* @see java.sql.ResultSet#isFirst()
*/
boolean isFirst() throws InvalidResultSetAccessException;
/**
- * Retrieves whether the cursor is on the last row of this RowSet.
- * @return true if the cursor is after the last row, false otherwise
+ * Retrieve whether the cursor is on the last row of this row set.
+ * @return {@code true} if the cursor is after the last row,
+ * {@code false} otherwise
* @see java.sql.ResultSet#isLast()
*/
boolean isLast() throws InvalidResultSetAccessException;
/**
- * Moves the cursor to the last row of this RowSet.
- * @return true if the cursor is on a valid row, false otherwise
+ * Move the cursor to the last row of this row set.
+ * @return {@code true} if the cursor is on a valid row,
+ * {@code false} otherwise
* @see java.sql.ResultSet#last()
*/
boolean last() throws InvalidResultSetAccessException;
/**
- * Moves the cursor to the next row.
- * @return true if the new row is valid, false if there are no more rows
+ * Move the cursor to the next row.
+ * @return {@code true} if the new row is valid,
+ * {@code false} if there are no more rows
* @see java.sql.ResultSet#next()
*/
boolean next() throws InvalidResultSetAccessException;
/**
- * Moves the cursor to the previous row.
- * @return true if the new row is valid, false if it is off the RowSet
+ * Move the cursor to the previous row.
+ * @return {@code true} if the new row is valid,
+ * {@code false} if it is off the row set
* @see java.sql.ResultSet#previous()
*/
boolean previous() throws InvalidResultSetAccessException;
/**
- * Moves the cursor a relative number f rows, either positive or negative.
- * @return true if the cursor is on a row, false otherwise
+ * Move the cursor a relative number of rows,
+ * either positive or negative.
+ * @return {@code true} if the cursor is on a row,
+ * {@code false} otherwise
* @see java.sql.ResultSet#relative(int)
*/
boolean relative(int rows) throws InvalidResultSetAccessException;
/**
- * Reports whether the last column read had a value of SQL {@code NULL}.
- * Note that you must first call one of the getter methods and then call
- * the {@code wasNull} method.
- * @return true if the most recent coumn retrieved was SQL {@code NULL},
- * false otherwise
+ * Report whether the last column read had a value of SQL {@code NULL}.
+ * <p>Note that you must first call one of the getter methods
+ * and then call the {@code wasNull()} method.
+ * @return {@code true} if the most recent coumn retrieved was
+ * SQL {@code NULL}, {@code false} otherwise
* @see java.sql.ResultSet#wasNull()
*/
boolean wasNull() throws InvalidResultSetAccessException;
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSetMetaData.java b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSetMetaData.java
index b117177b..9ec1c795 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSetMetaData.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/support/rowset/SqlRowSetMetaData.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,25 +19,27 @@ package org.springframework.jdbc.support.rowset;
import org.springframework.jdbc.InvalidResultSetAccessException;
/**
- * Meta data interface for Spring's SqlRowSet,
- * analogous to {@code javax.sql.ResultSetMetaData}
+ * Metadata interface for Spring's {@link SqlRowSet}, analogous to JDBC's
+ * {@link java.sql.ResultSetMetaData}.
*
- * <p>The main difference to the standard JDBC RowSetMetaData is that an SQLException
- * is never thrown here. This allows a SqlRowSetMetaData to be used without having
- * to deal with checked exceptions. A SqlRowSetMetaData will throw Spring's
- * {@code org.springframework.jdbc.InvalidResultSetAccessException}
+ * <p>The main difference to the standard JDBC ResultSetMetaData is that a
+ * {@link java.sql.SQLException} is never thrown here. This allows
+ * SqlRowSetMetaData to be used without having to deal with checked exceptions.
+ * SqlRowSetMetaData will throw Spring's {@link InvalidResultSetAccessException}
* instead (when appropriate).
*
* @author Thomas Risberg
+ * @author Juergen Hoeller
* @since 1.2
- * @see SqlRowSet#getMetaData
+ * @see SqlRowSet#getMetaData()
* @see java.sql.ResultSetMetaData
* @see org.springframework.jdbc.InvalidResultSetAccessException
*/
public interface SqlRowSetMetaData {
/**
- * Retrieves the catalog name of the table that served as the source for the specified column.
+ * Retrieve the catalog name of the table that served as the source for the
+ * specified column.
* @param columnIndex the index of the column
* @return the catalog name
* @see java.sql.ResultSetMetaData#getCatalogName(int)
@@ -45,7 +47,7 @@ public interface SqlRowSetMetaData {
String getCatalogName(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the fully qualified class that the specified column will be mapped to.
+ * Retrieve the fully qualified class that the specified column will be mapped to.
* @param columnIndex the index of the column
* @return the class name as a String
* @see java.sql.ResultSetMetaData#getColumnClassName(int)
@@ -53,7 +55,7 @@ public interface SqlRowSetMetaData {
String getColumnClassName(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrives the number of columns in the RowSet.
+ * Retrieve the number of columns in the RowSet.
* @return the number of columns
* @see java.sql.ResultSetMetaData#getColumnCount()
*/
@@ -66,7 +68,7 @@ public interface SqlRowSetMetaData {
String[] getColumnNames() throws InvalidResultSetAccessException;
/**
- * Retrieves the maximum width of the designated column.
+ * Retrieve the maximum width of the designated column.
* @param columnIndex the index of the column
* @return the width of the column
* @see java.sql.ResultSetMetaData#getColumnDisplaySize(int)
@@ -99,7 +101,7 @@ public interface SqlRowSetMetaData {
int getColumnType(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the DBMS-specific type name for the indicated column.
+ * Retrieve the DBMS-specific type name for the indicated column.
* @param columnIndex the index of the column
* @return the type name
* @see java.sql.ResultSetMetaData#getColumnTypeName(int)
@@ -107,7 +109,7 @@ public interface SqlRowSetMetaData {
String getColumnTypeName(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the precision for the indicated column.
+ * Retrieve the precision for the indicated column.
* @param columnIndex the index of the column
* @return the precision
* @see java.sql.ResultSetMetaData#getPrecision(int)
@@ -115,7 +117,7 @@ public interface SqlRowSetMetaData {
int getPrecision(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the scale of the indicated column.
+ * Retrieve the scale of the indicated column.
* @param columnIndex the index of the column
* @return the scale
* @see java.sql.ResultSetMetaData#getScale(int)
@@ -123,7 +125,8 @@ public interface SqlRowSetMetaData {
int getScale(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the schema name of the table that served as the source for the specified column.
+ * Retrieve the schema name of the table that served as the source for the
+ * specified column.
* @param columnIndex the index of the column
* @return the schema name
* @see java.sql.ResultSetMetaData#getSchemaName(int)
@@ -131,7 +134,8 @@ public interface SqlRowSetMetaData {
String getSchemaName(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Retrieves the name of the table that served as the source for the specified column.
+ * Retrieve the name of the table that served as the source for the
+ * specified column.
* @param columnIndex the index of the column
* @return the name of the table
* @see java.sql.ResultSetMetaData#getTableName(int)
@@ -139,7 +143,7 @@ public interface SqlRowSetMetaData {
String getTableName(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Indicates whether the case of the designated column is significant.
+ * Indicate whether the case of the designated column is significant.
* @param columnIndex the index of the column
* @return true if the case sensitive, false otherwise
* @see java.sql.ResultSetMetaData#isCaseSensitive(int)
@@ -147,7 +151,7 @@ public interface SqlRowSetMetaData {
boolean isCaseSensitive(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Indicates whether the designated column contains a currency value.
+ * Indicate whether the designated column contains a currency value.
* @param columnIndex the index of the column
* @return true if the value is a currency value, false otherwise
* @see java.sql.ResultSetMetaData#isCurrency(int)
@@ -155,7 +159,7 @@ public interface SqlRowSetMetaData {
boolean isCurrency(int columnIndex) throws InvalidResultSetAccessException;
/**
- * Indicates whether the designated column contains a signed number.
+ * Indicate whether the designated column contains a signed number.
* @param columnIndex the index of the column
* @return true if the column contains a signed number, false otherwise
* @see java.sql.ResultSetMetaData#isSigned(int)