Polishing

This commit is contained in:
Juergen Hoeller 2018-03-19 12:05:04 +01:00
parent 2c7efbb9d0
commit 702b27e1e4
32 changed files with 252 additions and 287 deletions

View File

@ -50,7 +50,7 @@ import org.springframework.util.StringUtils;
* top-level class and it must have a default or no-arg constructor. * top-level class and it must have a default or no-arg constructor.
* *
* <p>Column values are mapped based on matching the column name as obtained from result set * <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 * meta-data to public setters for the corresponding properties. The names are matched either
* directly or by transforming a name separating the parts with underscores to the same name * directly or by transforming a name separating the parts with underscores to the same name
* using "camel" case. * using "camel" case.
* *
@ -214,7 +214,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T> {
/** /**
* Initialize the mapping metadata for the given class. * Initialize the mapping meta-data for the given class.
* @param mappedClass the mapped class * @param mappedClass the mapped class
*/ */
protected void initialize(Class<T> mappedClass) { protected void initialize(Class<T> mappedClass) {
@ -275,7 +275,7 @@ public class BeanPropertyRowMapper<T> implements RowMapper<T> {
/** /**
* Extract the values for all columns in the current row. * Extract the values for all columns in the current row.
* <p>Utilizes public setters and result set metadata. * <p>Utilizes public setters and result set meta-data.
* @see java.sql.ResultSetMetaData * @see java.sql.ResultSetMetaData
*/ */
@Override @Override

View File

@ -244,7 +244,7 @@ public class PreparedStatementCreatorFactory {
for (int i = 0; i < this.parameters.size(); i++) { for (int i = 0; i < this.parameters.size(); i++) {
Object in = this.parameters.get(i); Object in = this.parameters.get(i);
SqlParameter declaredParameter; SqlParameter declaredParameter;
// SqlParameterValue overrides declared parameter metadata, in particular for // SqlParameterValue overrides declared parameter meta-data, in particular for
// independence from the declared parameter position in case of named parameters. // independence from the declared parameter position in case of named parameters.
if (in instanceof SqlParameterValue) { if (in instanceof SqlParameterValue) {
SqlParameterValue paramValue = (SqlParameterValue) in; SqlParameterValue paramValue = (SqlParameterValue) in;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -135,7 +135,7 @@ public class ResultSetSupportingSqlParameter extends SqlParameter {
/** /**
* <p>This implementation always returns {@code false}. * This implementation always returns {@code false}.
*/ */
@Override @Override
public boolean isInputValueProvided() { public boolean isInputValueProvided() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,8 +21,7 @@ package org.springframework.jdbc.core;
* Will return {@code true} for SqlParameter's {@link #isInputValueProvided} * Will return {@code true} for SqlParameter's {@link #isInputValueProvided}
* test, in contrast to a standard SqlOutParameter. * test, in contrast to a standard SqlOutParameter.
* *
* <p>Output parameters - like all stored procedure parameters - * <p>Output parameters - like all stored procedure parameters - must have names.
* must have names.
* *
* @author Thomas Risberg * @author Thomas Risberg
* @author Juergen Hoeller * @author Juergen Hoeller

View File

@ -19,12 +19,10 @@ package org.springframework.jdbc.core;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
/** /**
* Subclass of SqlParameter to represent an output parameter. * Subclass of {@link SqlParameter} to represent an output parameter.
* No additional properties: instanceof will be used to check * No additional properties: instanceof will be used to check for such types.
* for such types.
* *
* <p>Output parameters - like all stored procedure parameters - * <p>Output parameters - like all stored procedure parameters - must have names.
* must have names.
* *
* @author Rod Johnson * @author Rod Johnson
* @author Thomas Risberg * @author Thomas Risberg

View File

@ -172,7 +172,7 @@ public class SqlParameter {
/** /**
* Return whether this parameter is an implicit return parameter used during the * Return whether this parameter is an implicit return parameter used during the
* results preocessing of the CallableStatement.getMoreResults/getUpdateCount. * results processing of {@code CallableStatement.getMoreResults/getUpdateCount}.
* <p>This implementation always returns {@code false}. * <p>This implementation always returns {@code false}.
*/ */
public boolean isResultsParameter() { public boolean isResultsParameter() {

View File

@ -19,7 +19,7 @@ package org.springframework.jdbc.core;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
/** /**
* Object to represent a SQL parameter value, including parameter metadata * Object to represent a SQL parameter value, including parameter meta-data
* such as the SQL type and the scale for numeric values. * 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 * <p>Designed for use with {@link JdbcTemplate}'s operations that take an array of

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@ package org.springframework.jdbc.core;
* must be provided to handle any returned rows. * must be provided to handle any returned rows.
* *
* <p>Returned {@link java.sql.ResultSet ResultSets} - like all stored procedure * <p>Returned {@link java.sql.ResultSet ResultSets} - like all stored procedure
* parameters - <b>must</b> have names. * parameters - must have names.
* *
* @author Thomas Risberg * @author Thomas Risberg
* @author Juergen Hoeller * @author Juergen Hoeller
@ -57,13 +57,13 @@ public class SqlReturnResultSet extends ResultSetSupportingSqlParameter {
super(name, 0, mapper); super(name, 0, mapper);
} }
/** /**
* Return whether this parameter is an implicit return parameter used during the * This implementation always returns {@code true}.
* results preocessing of the CallableStatement.getMoreResults/getUpdateCount.
* <p>This implementation always returns {@code true}.
*/ */
@Override @Override
public boolean isResultsParameter() { public boolean isResultsParameter() {
return true; return true;
} }
} }

View File

@ -1,3 +1,19 @@
/*
* Copyright 2002-2018 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.jdbc.core; package org.springframework.jdbc.core;
import java.sql.Types; import java.sql.Types;
@ -13,7 +29,7 @@ import java.sql.Types;
public class SqlReturnUpdateCount extends SqlParameter { public class SqlReturnUpdateCount extends SqlParameter {
/** /**
* Create a new instance of the {@link SqlReturnUpdateCount} class. * Create a new SqlReturnUpdateCount.
* @param name name of the parameter, as used in input and output maps * @param name name of the parameter, as used in input and output maps
*/ */
public SqlReturnUpdateCount(String name) { public SqlReturnUpdateCount(String name) {
@ -22,9 +38,7 @@ public class SqlReturnUpdateCount extends SqlParameter {
/** /**
* Return whether this parameter holds input values that should be set * This implementation always returns {@code false}.
* before execution even if they are {@code null}.
* <p>This implementation always returns {@code false}.
*/ */
@Override @Override
public boolean isInputValueProvided() { public boolean isInputValueProvided() {
@ -32,12 +46,11 @@ public class SqlReturnUpdateCount extends SqlParameter {
} }
/** /**
* Return whether this parameter is an implicit return parameter used during the * This implementation always returns {@code true}.
* results preocessing of the CallableStatement.getMoreResults/getUpdateCount.
* <p>This implementation always returns {@code true}.
*/ */
@Override @Override
public boolean isResultsParameter() { public boolean isResultsParameter() {
return true; return true;
} }
} }

View File

@ -24,7 +24,7 @@ import org.springframework.jdbc.core.SqlParameter;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
/** /**
* Interface specifying the API to be implemented by a class providing call metadata. * Interface specifying the API to be implemented by a class providing call meta-data.
* *
* <p>This is intended for internal use by Spring's * <p>This is intended for internal use by Spring's
* {@link org.springframework.jdbc.core.simple.SimpleJdbcCall}. * {@link org.springframework.jdbc.core.simple.SimpleJdbcCall}.
@ -42,9 +42,9 @@ public interface CallMetaDataProvider {
void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException; void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException;
/** /**
* Initialize the database specific management of procedure column meta data. * Initialize the database specific management of procedure column meta-data.
* This is only called for databases that are supported. This initialization * This is only called for databases that are supported. This initialization
* can be turned off by specifying that column meta data should not be used. * can be turned off by specifying that column meta-data should not be used.
* @param databaseMetaData used to retrieve database specific information * @param databaseMetaData used to retrieve database specific information
* @param catalogName name of catalog to use (or {@code null} if none) * @param catalogName name of catalog to use (or {@code null} if none)
* @param schemaName name of schema name to use (or {@code null} if none) * @param schemaName name of schema name to use (or {@code null} if none)
@ -56,44 +56,44 @@ public interface CallMetaDataProvider {
@Nullable String schemaName, @Nullable String procedureName) throws SQLException; @Nullable String schemaName, @Nullable String procedureName) throws SQLException;
/** /**
* Provide any modification of the procedure name passed in to match the meta data currently used. * Provide any modification of the procedure name passed in to match the meta-data currently used.
* This could include altering the case. * This could include altering the case.
*/ */
@Nullable @Nullable
String procedureNameToUse(@Nullable String procedureName); String procedureNameToUse(@Nullable String procedureName);
/** /**
* Provide any modification of the catalog name passed in to match the meta data currently used. * Provide any modification of the catalog name passed in to match the meta-data currently used.
* This could include altering the case. * This could include altering the case.
*/ */
@Nullable @Nullable
String catalogNameToUse(@Nullable String catalogName); String catalogNameToUse(@Nullable String catalogName);
/** /**
* Provide any modification of the schema name passed in to match the meta data currently used. * Provide any modification of the schema name passed in to match the meta-data currently used.
* This could include altering the case. * This could include altering the case.
*/ */
@Nullable @Nullable
String schemaNameToUse(@Nullable String schemaName); String schemaNameToUse(@Nullable String schemaName);
/** /**
* Provide any modification of the catalog name passed in to match the meta data currently used. * Provide any modification of the catalog name passed in to match the meta-data currently used.
* The returned value will be used for meta data lookups. This could include altering the case * The returned value will be used for meta-data lookups. This could include altering the case
* used or providing a base catalog if none is provided. * used or providing a base catalog if none is provided.
*/ */
@Nullable @Nullable
String metaDataCatalogNameToUse(@Nullable String catalogName) ; String metaDataCatalogNameToUse(@Nullable String catalogName) ;
/** /**
* Provide any modification of the schema name passed in to match the meta data currently used. * Provide any modification of the schema name passed in to match the meta-data currently used.
* The returned value will be used for meta data lookups. This could include altering the case * The returned value will be used for meta-data lookups. This could include altering the case
* used or providing a base schema if none is provided. * used or providing a base schema if none is provided.
*/ */
@Nullable @Nullable
String metaDataSchemaNameToUse(@Nullable String schemaName); String metaDataSchemaNameToUse(@Nullable String schemaName);
/** /**
* Provide any modification of the column name passed in to match the meta data currently used. * Provide any modification of the column name passed in to match the meta-data currently used.
* This could include altering the case. * This could include altering the case.
* @param parameterName name of the parameter of column * @param parameterName name of the parameter of column
*/ */
@ -101,42 +101,42 @@ public interface CallMetaDataProvider {
String parameterNameToUse(@Nullable String parameterName); String parameterNameToUse(@Nullable String parameterName);
/** /**
* Create a default out parameter based on the provided meta data. * Create a default out parameter based on the provided meta-data.
* This is used when no explicit parameter declaration has been made. * This is used when no explicit parameter declaration has been made.
* @param parameterName the name of the parameter * @param parameterName the name of the parameter
* @param meta meta data used for this call * @param meta meta-data used for this call
* @return the configured SqlOutParameter * @return the configured SqlOutParameter
*/ */
SqlParameter createDefaultOutParameter(String parameterName, CallParameterMetaData meta); SqlParameter createDefaultOutParameter(String parameterName, CallParameterMetaData meta);
/** /**
* Create a default inout parameter based on the provided meta data. * Create a default inout parameter based on the provided meta-data.
* This is used when no explicit parameter declaration has been made. * This is used when no explicit parameter declaration has been made.
* @param parameterName the name of the parameter * @param parameterName the name of the parameter
* @param meta meta data used for this call * @param meta meta-data used for this call
* @return the configured SqlInOutParameter * @return the configured SqlInOutParameter
*/ */
SqlParameter createDefaultInOutParameter(String parameterName, CallParameterMetaData meta); SqlParameter createDefaultInOutParameter(String parameterName, CallParameterMetaData meta);
/** /**
* Create a default in parameter based on the provided meta data. * Create a default in parameter based on the provided meta-data.
* This is used when no explicit parameter declaration has been made. * This is used when no explicit parameter declaration has been made.
* @param parameterName the name of the parameter * @param parameterName the name of the parameter
* @param meta meta data used for this call * @param meta meta-data used for this call
* @return the configured SqlParameter * @return the configured SqlParameter
*/ */
SqlParameter createDefaultInParameter(String parameterName, CallParameterMetaData meta); SqlParameter createDefaultInParameter(String parameterName, CallParameterMetaData meta);
/** /**
* Get the name of the current user. Useful for meta data lookups etc. * Get the name of the current user. Useful for meta-data lookups etc.
* @return current user name from database connection * @return current user name from database connection
*/ */
@Nullable @Nullable
String getUserName(); String getUserName();
/** /**
* Does this database support returning ResultSets that should be retrieved with the JDBC call. * Does this database support returning ResultSets that should be retrieved with the JDBC call:
* {@link java.sql.Statement#getResultSet()} * {@link java.sql.Statement#getResultSet()}?
*/ */
boolean isReturnResultSetSupported(); boolean isReturnResultSetSupported();
@ -153,7 +153,7 @@ public interface CallMetaDataProvider {
int getRefCursorSqlType(); int getRefCursorSqlType();
/** /**
* Are we using the meta data for the procedure columns? * Are we using the meta-data for the procedure columns?
*/ */
boolean isProcedureColumnMetaDataUsed(); boolean isProcedureColumnMetaDataUsed();
@ -165,18 +165,18 @@ public interface CallMetaDataProvider {
boolean byPassReturnParameter(String parameterName); boolean byPassReturnParameter(String parameterName);
/** /**
* Get the call parameter metadata that is currently used. * Get the call parameter meta-data that is currently used.
* @return List of {@link CallParameterMetaData} * @return List of {@link CallParameterMetaData}
*/ */
List<CallParameterMetaData> getCallParameterMetaData(); List<CallParameterMetaData> getCallParameterMetaData();
/** /**
* Does the database support the use of catalog name in procedure calls * Does the database support the use of catalog name in procedure calls?
*/ */
boolean isSupportsCatalogsInProcedureCalls(); boolean isSupportsCatalogsInProcedureCalls();
/** /**
* Does the database support the use of schema name in procedure calls * Does the database support the use of schema name in procedure calls?
*/ */
boolean isSupportsSchemasInProcedureCalls(); boolean isSupportsSchemasInProcedureCalls();

View File

@ -60,9 +60,9 @@ public class CallMetaDataProviderFactory {
/** /**
* Create a {@link CallMetaDataProvider} based on the database metadata * Create a {@link CallMetaDataProvider} based on the database meta-data
* @param dataSource used to retrieve metadata * @param dataSource used to retrieve meta-data
* @param context the class that holds configuration and metadata * @param context the class that holds configuration and meta-data
* @return instance of the CallMetaDataProvider implementation to be used * @return instance of the CallMetaDataProvider implementation to be used
*/ */
public static CallMetaDataProvider createMetaDataProvider(DataSource dataSource, final CallMetaDataContext context) { public static CallMetaDataProvider createMetaDataProvider(DataSource dataSource, final CallMetaDataContext context) {
@ -133,7 +133,7 @@ public class CallMetaDataProviderFactory {
}); });
} }
catch (MetaDataAccessException ex) { catch (MetaDataAccessException ex) {
throw new DataAccessResourceFailureException("Error retrieving database metadata", ex); throw new DataAccessResourceFailureException("Error retrieving database meta-data", ex);
} }
} }

View File

@ -21,7 +21,7 @@ import java.sql.SQLException;
/** /**
* The Derby specific implementation of {@link TableMetaDataProvider}. * The Derby specific implementation of {@link TableMetaDataProvider}.
* Overrides the Derby metadata info regarding retrieving generated keys. * Overrides the Derby meta-data info regarding retrieving generated keys.
* *
* @author Thomas Risberg * @author Thomas Risberg
* @since 3.0 * @since 3.0

View File

@ -62,8 +62,8 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
/** /**
* Constructor used to initialize with provided database meta data. * Constructor used to initialize with provided database meta-data.
* @param databaseMetaData meta data to be used * @param databaseMetaData meta-data to be used
*/ */
protected GenericCallMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException { protected GenericCallMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException {
this.userName = databaseMetaData.getUserName(); this.userName = databaseMetaData.getUserName();
@ -315,7 +315,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
/** /**
* Process the procedure column metadata * Process the procedure column meta-data
*/ */
private void processProcedureColumns(DatabaseMetaData databaseMetaData, private void processProcedureColumns(DatabaseMetaData databaseMetaData,
@Nullable String catalogName, @Nullable String schemaName, @Nullable String procedureName) { @Nullable String catalogName, @Nullable String schemaName, @Nullable String procedureName) {
@ -324,7 +324,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
String metaDataSchemaName = metaDataSchemaNameToUse(schemaName); String metaDataSchemaName = metaDataSchemaNameToUse(schemaName);
String metaDataProcedureName = procedureNameToUse(procedureName); String metaDataProcedureName = procedureNameToUse(procedureName);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Retrieving metadata for " + metaDataCatalogName + '/' + logger.debug("Retrieving meta-data for " + metaDataCatalogName + '/' +
metaDataSchemaName + '/' + metaDataProcedureName); metaDataSchemaName + '/' + metaDataProcedureName);
} }
@ -375,7 +375,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
columnType == DatabaseMetaData.procedureColumnInOut || columnType == DatabaseMetaData.procedureColumnInOut ||
columnType == DatabaseMetaData.procedureColumnOut)) { columnType == DatabaseMetaData.procedureColumnOut)) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Skipping metadata for: " + columnType + " " + procs.getInt("DATA_TYPE") + logger.debug("Skipping meta-data for: " + columnType + " " + procs.getInt("DATA_TYPE") +
" " + procs.getString("TYPE_NAME") + " " + procs.getInt("NULLABLE") + " " + procs.getString("TYPE_NAME") + " " + procs.getInt("NULLABLE") +
" (probably a member of a collection)"); " (probably a member of a collection)");
} }
@ -386,7 +386,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
procs.getInt("NULLABLE") == DatabaseMetaData.procedureNullable); procs.getInt("NULLABLE") == DatabaseMetaData.procedureNullable);
this.callParameterMetaData.add(meta); this.callParameterMetaData.add(meta);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Retrieved metadata: " + meta.getParameterName() + " " + logger.debug("Retrieved meta-data: " + meta.getParameterName() + " " +
meta.getParameterType() + " " + meta.getSqlType() + " " + meta.getParameterType() + " " + meta.getSqlType() + " " +
meta.getTypeName() + " " + meta.isNullable()); meta.getTypeName() + " " + meta.isNullable());
} }
@ -395,7 +395,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
} }
catch (SQLException ex) { catch (SQLException ex) {
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
logger.warn("Error while retrieving metadata for procedure columns: " + ex); logger.warn("Error while retrieving meta-data for procedure columns: " + ex);
} }
} }
finally { finally {
@ -406,7 +406,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
} }
catch (SQLException ex) { catch (SQLException ex) {
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
logger.warn("Problem closing ResultSet for procedure column metadata: " + ex); logger.warn("Problem closing ResultSet for procedure column meta-data: " + ex);
} }
} }
} }

View File

@ -46,7 +46,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
/** Logger available to subclasses */ /** Logger available to subclasses */
protected static final Log logger = LogFactory.getLog(TableMetaDataProvider.class); protected static final Log logger = LogFactory.getLog(TableMetaDataProvider.class);
/** indicator whether column metadata should be used */ /** indicator whether column meta-data should be used */
private boolean tableColumnMetaDataUsed = false; private boolean tableColumnMetaDataUsed = false;
/** the version of the database */ /** the version of the database */
@ -78,8 +78,8 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
/** /**
* Constructor used to initialize with provided database metadata. * Constructor used to initialize with provided database meta-data.
* @param databaseMetaData metadata to be used * @param databaseMetaData meta-data to be used
*/ */
protected GenericTableMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException { protected GenericTableMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException {
this.userName = databaseMetaData.getUserName(); this.userName = databaseMetaData.getUserName();
@ -305,7 +305,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
} }
/** /**
* Method supporting the metadata processing for a table. * Method supporting the meta-data processing for a table.
*/ */
private void locateTableAndProcessMetaData(DatabaseMetaData databaseMetaData, private void locateTableAndProcessMetaData(DatabaseMetaData databaseMetaData,
@Nullable String catalogName, @Nullable String schemaName, @Nullable String tableName) { @Nullable String catalogName, @Nullable String schemaName, @Nullable String tableName) {
@ -330,7 +330,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
} }
catch (SQLException ex) { catch (SQLException ex) {
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
logger.warn("Error while accessing table meta data results: " + ex.getMessage()); logger.warn("Error while accessing table meta-data results: " + ex.getMessage());
} }
} }
finally { finally {
@ -339,7 +339,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
if (tableMeta.isEmpty()) { if (tableMeta.isEmpty()) {
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
logger.warn("Unable to locate table meta data for '" + tableName + "': column names must be provided"); logger.warn("Unable to locate table meta-data for '" + tableName + "': column names must be provided");
} }
} }
else { else {
@ -353,7 +353,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
if (schemaName != null) { if (schemaName != null) {
TableMetaData tmd = tableMeta.get(schemaName.toUpperCase()); TableMetaData tmd = tableMeta.get(schemaName.toUpperCase());
if (tmd == null) { if (tmd == null) {
throw new DataAccessResourceFailureException("Unable to locate table meta data for '" + throw new DataAccessResourceFailureException("Unable to locate table meta-data for '" +
tableName + "' in the '" + schemaName + "' schema"); tableName + "' in the '" + schemaName + "' schema");
} }
return tmd; return tmd;
@ -374,14 +374,14 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
} }
if (tmd == null) { if (tmd == null) {
throw new DataAccessResourceFailureException( throw new DataAccessResourceFailureException(
"Unable to locate table meta data for '" + tableName + "' in the default schema"); "Unable to locate table meta-data for '" + tableName + "' in the default schema");
} }
return tmd; return tmd;
} }
} }
/** /**
* Method supporting the metadata processing for a table's columns * Method supporting the meta-data processing for a table's columns
*/ */
private void processTableColumns(DatabaseMetaData databaseMetaData, TableMetaData tmd) { private void processTableColumns(DatabaseMetaData databaseMetaData, TableMetaData tmd) {
ResultSet tableColumns = null; ResultSet tableColumns = null;
@ -389,7 +389,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
String metaDataSchemaName = metaDataSchemaNameToUse(tmd.getSchemaName()); String metaDataSchemaName = metaDataSchemaNameToUse(tmd.getSchemaName());
String metaDataTableName = tableNameToUse(tmd.getTableName()); String metaDataTableName = tableNameToUse(tmd.getTableName());
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Retrieving metadata for " + metaDataCatalogName + '/' + logger.debug("Retrieving meta-data for " + metaDataCatalogName + '/' +
metaDataSchemaName + '/' + metaDataTableName); metaDataSchemaName + '/' + metaDataTableName);
} }
try { try {
@ -407,7 +407,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
if ("NUMBER".equals(typeName) && decimalDigits == 0) { if ("NUMBER".equals(typeName) && decimalDigits == 0) {
dataType = Types.NUMERIC; dataType = Types.NUMERIC;
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Overriding metadata: " + columnName + " now NUMERIC instead of DECIMAL"); logger.debug("Overriding meta-data: " + columnName + " now NUMERIC instead of DECIMAL");
} }
} }
} }
@ -415,14 +415,14 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
TableParameterMetaData meta = new TableParameterMetaData(columnName, dataType, nullable); TableParameterMetaData meta = new TableParameterMetaData(columnName, dataType, nullable);
this.tableParameterMetaData.add(meta); this.tableParameterMetaData.add(meta);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Retrieved metadata: " + meta.getParameterName() + " " + logger.debug("Retrieved meta-data: " + meta.getParameterName() + " " +
meta.getSqlType() + " " + meta.isNullable()); meta.getSqlType() + " " + meta.isNullable());
} }
} }
} }
catch (SQLException ex) { catch (SQLException ex) {
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
logger.warn("Error while retrieving metadata for table columns: " + ex.getMessage()); logger.warn("Error while retrieving meta-data for table columns: " + ex.getMessage());
} }
} }
finally { finally {
@ -432,7 +432,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
/** /**
* Inner class representing table meta data. * Inner class representing table meta-data.
*/ */
private static class TableMetaData { private static class TableMetaData {

View File

@ -29,7 +29,7 @@ import org.springframework.util.ReflectionUtils;
/** /**
* Oracle-specific implementation of the {@link org.springframework.jdbc.core.metadata.TableMetaDataProvider}. * Oracle-specific implementation of the {@link org.springframework.jdbc.core.metadata.TableMetaDataProvider}.
* Supports a feature for including synonyms in the metadata lookup. Also supports lookup of current schema * Supports a feature for including synonyms in the meta-data lookup. Also supports lookup of current schema
* using the {@code sys_context}. * using the {@code sys_context}.
* *
* <p>Thanks to Mike Youngstrom and Bruce Campbell for submitting the original suggestion for the Oracle * <p>Thanks to Mike Youngstrom and Bruce Campbell for submitting the original suggestion for the Oracle
@ -48,16 +48,16 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
/** /**
* Constructor used to initialize with provided database metadata. * Constructor used to initialize with provided database meta-data.
* @param databaseMetaData metadata to be used * @param databaseMetaData meta-data to be used
*/ */
public OracleTableMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException { public OracleTableMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException {
this(databaseMetaData, false); this(databaseMetaData, false);
} }
/** /**
* Constructor used to initialize with provided database metadata. * Constructor used to initialize with provided database meta-data.
* @param databaseMetaData metadata to be used * @param databaseMetaData meta-data to be used
* @param includeSynonyms whether to include synonyms * @param includeSynonyms whether to include synonyms
*/ */
public OracleTableMetaDataProvider(DatabaseMetaData databaseMetaData, boolean includeSynonyms) public OracleTableMetaDataProvider(DatabaseMetaData databaseMetaData, boolean includeSynonyms)
@ -115,14 +115,14 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
throws SQLException { throws SQLException {
if (!this.includeSynonyms) { if (!this.includeSynonyms) {
logger.debug("Defaulting to no synonyms in table metadata lookup"); logger.debug("Defaulting to no synonyms in table meta-data lookup");
super.initializeWithTableColumnMetaData(databaseMetaData, catalogName, schemaName, tableName); super.initializeWithTableColumnMetaData(databaseMetaData, catalogName, schemaName, tableName);
return; return;
} }
Connection con = databaseMetaData.getConnection(); Connection con = databaseMetaData.getConnection();
if (con == null) { if (con == null) {
logger.warn("Unable to include synonyms in table metadata lookup - no Connection from DatabaseMetaData"); logger.warn("Unable to include synonyms in table meta-data lookup - no Connection from DatabaseMetaData");
super.initializeWithTableColumnMetaData(databaseMetaData, catalogName, schemaName, tableName); super.initializeWithTableColumnMetaData(databaseMetaData, catalogName, schemaName, tableName);
return; return;
} }
@ -133,13 +133,13 @@ public class OracleTableMetaDataProvider extends GenericTableMetaDataProvider {
} }
catch (ClassNotFoundException | SQLException ex) { catch (ClassNotFoundException | SQLException ex) {
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
logger.warn("Unable to include synonyms in table metadata lookup - no Oracle Connection: " + ex); logger.warn("Unable to include synonyms in table meta-data lookup - no Oracle Connection: " + ex);
} }
super.initializeWithTableColumnMetaData(databaseMetaData, catalogName, schemaName, tableName); super.initializeWithTableColumnMetaData(databaseMetaData, catalogName, schemaName, tableName);
return; return;
} }
logger.debug("Including synonyms in table metadata lookup"); logger.debug("Including synonyms in table meta-data lookup");
Method setIncludeSynonyms; Method setIncludeSynonyms;
Boolean originalValueForIncludeSynonyms; Boolean originalValueForIncludeSynonyms;

View File

@ -23,7 +23,7 @@ import java.util.List;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
/** /**
* Interface specifying the API to be implemented by a class providing table metadata. * Interface specifying the API to be implemented by a class providing table meta-data.
* This is intended for internal use by the Simple JDBC classes. * This is intended for internal use by the Simple JDBC classes.
* *
* @author Thomas Risberg * @author Thomas Risberg
@ -32,15 +32,15 @@ import org.springframework.lang.Nullable;
public interface TableMetaDataProvider { public interface TableMetaDataProvider {
/** /**
* Initialize using the database metadata provided. * Initialize using the database meta-data provided.
* @param databaseMetaData used to retrieve database specific information * @param databaseMetaData used to retrieve database specific information
* @throws SQLException in case of initialization failure * @throws SQLException in case of initialization failure
*/ */
void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException; void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException;
/** /**
* Initialize using provided database metadata, table and column information. * Initialize using provided database meta-data, table and column information.
* This initialization can be turned off by specifying that column meta data should not be used. * This initialization can be turned off by specifying that column meta-data should not be used.
* @param databaseMetaData used to retrieve database specific information * @param databaseMetaData used to retrieve database specific information
* @param catalogName name of catalog to use (or {@code null} if none) * @param catalogName name of catalog to use (or {@code null} if none)
* @param schemaName name of schema name to use (or {@code null} if none) * @param schemaName name of schema name to use (or {@code null} if none)
@ -51,46 +51,49 @@ public interface TableMetaDataProvider {
@Nullable String schemaName, @Nullable String tableName) throws SQLException; @Nullable String schemaName, @Nullable String tableName) throws SQLException;
/** /**
* Get the table name formatted based on metadata information. This could include altering the case. * Get the table name formatted based on meta-data information.
* This could include altering the case.
*/ */
@Nullable @Nullable
String tableNameToUse(@Nullable String tableName); String tableNameToUse(@Nullable String tableName);
/** /**
* Get the catalog name formatted based on metadata information. This could include altering the case. * Get the catalog name formatted based on meta-data information.
* This could include altering the case.
*/ */
@Nullable @Nullable
String catalogNameToUse(@Nullable String catalogName); String catalogNameToUse(@Nullable String catalogName);
/** /**
* Get the schema name formatted based on metadata information. This could include altering the case. * Get the schema name formatted based on meta-data information.
* This could include altering the case.
*/ */
@Nullable @Nullable
String schemaNameToUse(@Nullable String schemaName); String schemaNameToUse(@Nullable String schemaName);
/** /**
* Provide any modification of the catalog name passed in to match the meta data currently used. * Provide any modification of the catalog name passed in to match the meta-data currently used.
* The returned value will be used for meta data lookups. This could include altering the case used or * The returned value will be used for meta-data lookups.
* providing a base catalog if none is provided. * This could include altering the case used or providing a base catalog if none is provided.
*/ */
@Nullable @Nullable
String metaDataCatalogNameToUse(@Nullable String catalogName) ; String metaDataCatalogNameToUse(@Nullable String catalogName) ;
/** /**
* Provide any modification of the schema name passed in to match the meta data currently used. * Provide any modification of the schema name passed in to match the meta-data currently used.
* The returned value will be used for meta data lookups. This could include altering the case used or * The returned value will be used for meta-data lookups.
* providing a base schema if none is provided. * This could include altering the case used or providing a base schema if none is provided.
*/ */
@Nullable @Nullable
String metaDataSchemaNameToUse(@Nullable String schemaName) ; String metaDataSchemaNameToUse(@Nullable String schemaName) ;
/** /**
* Are we using the meta data for the table columns? * Are we using the meta-data for the table columns?
*/ */
boolean isTableColumnMetaDataUsed(); boolean isTableColumnMetaDataUsed();
/** /**
* Does this database support the JDBC 3.0 feature of retrieving generated keys * Does this database support the JDBC 3.0 feature of retrieving generated keys:
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}? * {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
*/ */
boolean isGetGeneratedKeysSupported(); boolean isGetGeneratedKeysSupported();
@ -103,19 +106,19 @@ public interface TableMetaDataProvider {
boolean isGetGeneratedKeysSimulated(); boolean isGetGeneratedKeysSimulated();
/** /**
* Get the simple query to retrieve a generated key * Get the simple query to retrieve a generated key.
*/ */
@Nullable @Nullable
String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName); String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName);
/** /**
* Does this database support a column name String array for retrieving generated keys * Does this database support a column name String array for retrieving generated keys:
* {@link java.sql.Connection#createStruct(String, Object[])} * {@link java.sql.Connection#createStruct(String, Object[])}?
*/ */
boolean isGeneratedKeysColumnNameArraySupported(); boolean isGeneratedKeysColumnNameArraySupported();
/** /**
* Get the table parameter metadata that is currently used. * Get the table parameter meta-data that is currently used.
* @return List of {@link TableParameterMetaData} * @return List of {@link TableParameterMetaData}
*/ */
List<TableParameterMetaData> getTableParameterMetaData(); List<TableParameterMetaData> getTableParameterMetaData();

View File

@ -38,9 +38,9 @@ public class TableMetaDataProviderFactory {
/** /**
* Create a {@link TableMetaDataProvider} based on the database metadata. * Create a {@link TableMetaDataProvider} based on the database meta-data.
* @param dataSource used to retrieve metadata * @param dataSource used to retrieve meta-data
* @param context the class that holds configuration and metadata * @param context the class that holds configuration and meta-data
* @return instance of the TableMetaDataProvider implementation to be used * @return instance of the TableMetaDataProvider implementation to be used
*/ */
public static TableMetaDataProvider createMetaDataProvider(DataSource dataSource, TableMetaDataContext context) { public static TableMetaDataProvider createMetaDataProvider(DataSource dataSource, TableMetaDataContext context) {
@ -80,7 +80,7 @@ public class TableMetaDataProviderFactory {
}); });
} }
catch (MetaDataAccessException ex) { catch (MetaDataAccessException ex) {
throw new DataAccessResourceFailureException("Error retrieving database metadata", ex); throw new DataAccessResourceFailureException("Error retrieving database meta-data", ex);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,7 +17,7 @@
package org.springframework.jdbc.core.metadata; package org.springframework.jdbc.core.metadata;
/** /**
* Holder of metadata for a specific parameter that is used for table processing. * Holder of meta-data for a specific parameter that is used for table processing.
* *
* @author Thomas Risberg * @author Thomas Risberg
* @since 2.5 * @since 2.5

View File

@ -1,5 +1,6 @@
/** /**
* Context metadata abstraction for the configuration and execution of a stored procedure call. * Context metadata abstraction for the configuration and execution
* of table inserts and stored procedure calls.
*/ */
@NonNullApi @NonNullApi
@NonNullFields @NonNullFields

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -40,8 +40,9 @@ import org.springframework.util.StringUtils;
/** /**
* Abstract class to provide base functionality for easy stored procedure calls * Abstract class to provide base functionality for easy stored procedure calls
* based on configuration options and database metadata. * based on configuration options and database meta-data.
* This class provides the base SPI for {@link SimpleJdbcCall}. *
* <p>This class provides the base SPI for {@link SimpleJdbcCall}.
* *
* @author Thomas Risberg * @author Thomas Risberg
* @author Juergen Hoeller * @author Juergen Hoeller
@ -55,7 +56,7 @@ public abstract class AbstractJdbcCall {
/** Lower-level class used to execute SQL */ /** Lower-level class used to execute SQL */
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;
/** Context used to retrieve and manage database metadata */ /** Context used to retrieve and manage database meta-data */
private final CallMetaDataContext callMetaDataContext = new CallMetaDataContext(); private final CallMetaDataContext callMetaDataContext = new CallMetaDataContext();
/** List of SqlParameter objects */ /** List of SqlParameter objects */
@ -214,7 +215,7 @@ public abstract class AbstractJdbcCall {
} }
/** /**
* Specify whether the parameter metadata for the call should be used. * Specify whether the parameter meta-data for the call should be used.
* The default is {@code true}. * The default is {@code true}.
*/ */
public void setAccessCallParameterMetaData(boolean accessCallParameterMetaData) { public void setAccessCallParameterMetaData(boolean accessCallParameterMetaData) {
@ -222,7 +223,7 @@ public abstract class AbstractJdbcCall {
} }
/** /**
* Get the call string that should be used based on parameters and meta data. * Get the call string that should be used based on parameters and meta-data.
*/ */
@Nullable @Nullable
public String getCallString() { public String getCallString() {
@ -276,7 +277,7 @@ public abstract class AbstractJdbcCall {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/** /**
* Compile this JdbcCall using provided parameters and meta data plus other settings. * 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 * <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. * 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 * @throws org.springframework.dao.InvalidDataAccessApiUsageException if the object hasn't
@ -426,7 +427,7 @@ public abstract class AbstractJdbcCall {
/** /**
* Get a List of all the call parameters to be used for call. * Get a List of all the call parameters to be used for call.
* This includes any parameters added based on meta data processing. * This includes any parameters added based on meta-data processing.
*/ */
protected List<SqlParameter> getCallParameters() { protected List<SqlParameter> getCallParameters() {
return this.callMetaDataContext.getCallParameters(); return this.callMetaDataContext.getCallParameters();
@ -434,7 +435,7 @@ public abstract class AbstractJdbcCall {
/** /**
* Match the provided in parameter values with registered parameters and * Match the provided in parameter values with registered parameters and
* parameters defined via metadata processing. * parameters defined via meta-data processing.
* @param parameterSource the parameter vakues provided as a {@link SqlParameterSource} * @param parameterSource the parameter vakues provided as a {@link SqlParameterSource}
* @return Map with parameter names and values * @return Map with parameter names and values
*/ */
@ -444,7 +445,7 @@ public abstract class AbstractJdbcCall {
/** /**
* Match the provided in parameter values with registered parameters and * Match the provided in parameter values with registered parameters and
* parameters defined via metadata processing. * parameters defined via meta-data processing.
* @param args the parameter values provided as an array * @param args the parameter values provided as an array
* @return Map with parameter names and values * @return Map with parameter names and values
*/ */
@ -454,7 +455,7 @@ public abstract class AbstractJdbcCall {
/** /**
* Match the provided in parameter values with registered parameters and * Match the provided in parameter values with registered parameters and
* parameters defined via metadata processing. * parameters defined via meta-data processing.
* @param args the parameter values provided in a Map * @param args the parameter values provided in a Map
* @return Map with parameter names and values * @return Map with parameter names and values
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,26 +28,25 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource;
/** /**
* A SimpleJdbcCall is a multi-threaded, reusable object representing a call * A SimpleJdbcCall is a multi-threaded, reusable object representing a call
* to a stored procedure or a stored function. It provides meta data processing * to a stored procedure or a stored function. It provides meta-data processing
* to simplify the code needed to access basic stored procedures/functions. * to simplify the code needed to access basic stored procedures/functions.
* All you need to provide is the name of the procedure/function and a Map * All you need to provide is the name of the procedure/function and a Map
* containing the parameters when you execute the call. The names of the * containing the parameters when you execute the call. The names of the
* supplied parameters will be matched up with in and out parameters declared * supplied parameters will be matched up with in and out parameters declared
* when the stored procedure was created. * when the stored procedure was created.
* *
* <p>The meta data processing is based on the DatabaseMetaData provided by * <p>The meta-data processing is based on the DatabaseMetaData provided by
* the JDBC driver. Since we rely on the JDBC driver, this "auto-detection" * the JDBC driver. Since we rely on the JDBC driver, this "auto-detection"
* can only be used for databases that are known to provide accurate meta data. * can only be used for databases that are known to provide accurate meta-data.
* These currently include Derby, MySQL, Microsoft SQL Server, Oracle, DB2, * These currently include Derby, MySQL, Microsoft SQL Server, Oracle, DB2,
* Sybase and PostgreSQL. For any other databases you are required to declare * Sybase and PostgreSQL. For any other databases you are required to declare
* all parameters explicitly. You can of course declare all parameters * all parameters explicitly. You can of course declare all parameters
* explicitly even if the database provides the necessary meta data. In that * explicitly even if the database provides the necessary meta-data. In that
* case your declared parameters will take precedence. You can also turn off * case your declared parameters will take precedence. You can also turn off
* any metadata processing if you want to use parameter names that do not * any meta-data processing if you want to use parameter names that do not
* match what is declared during the stored procedure compilation. * match what is declared during the stored procedure compilation.
* *
* <p>The actual insert is being handled using Spring's * <p>The actual insert is being handled using Spring's {@link JdbcTemplate}.
* {@link org.springframework.jdbc.core.JdbcTemplate}.
* *
* <p>Many of the configuration methods return the current instance of the * <p>Many of the configuration methods return the current instance of the
* SimpleJdbcCall in order to provide the ability to chain multiple ones * SimpleJdbcCall in order to provide the ability to chain multiple ones

View File

@ -71,7 +71,7 @@ public interface SimpleJdbcCallOperations {
/** /**
* Specify one or more parameters if desired. These parameters will be supplemented with * Specify one or more parameters if desired. These parameters will be supplemented with
* any parameter information retrieved from the database meta data. * any parameter information retrieved from the database meta-data.
* <p>Note that only parameters declared as {@code SqlParameter} and {@code SqlInOutParameter} * <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} * 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 * class which - for backwards compatibility reasons - allows input values to be provided
@ -96,7 +96,7 @@ public interface SimpleJdbcCallOperations {
SimpleJdbcCallOperations returningResultSet(String parameterName, RowMapper<?> rowMapper); SimpleJdbcCallOperations returningResultSet(String parameterName, RowMapper<?> rowMapper);
/** /**
* Turn off any processing of parameter meta data information obtained via JDBC. * Turn off any processing of parameter meta-data information obtained via JDBC.
* @return the instance of this SimpleJdbcCall * @return the instance of this SimpleJdbcCall
*/ */
SimpleJdbcCallOperations withoutProcedureColumnMetaDataAccess(); SimpleJdbcCallOperations withoutProcedureColumnMetaDataAccess();

View File

@ -26,22 +26,23 @@ import org.springframework.jdbc.support.KeyHolder;
/** /**
* A SimpleJdbcInsert is a multi-threaded, reusable object providing easy insert * A SimpleJdbcInsert is a multi-threaded, reusable object providing easy insert
* capabilities for a table. It provides meta data processing to simplify the code * capabilities for a table. It provides meta-data processing to simplify the code
* needed to construct a basic insert statement. All you need to provide is the * needed to construct a basic insert statement. All you need to provide is the
* name of the table and a Map containing the column names and the column values. * name of the table and a Map containing the column names and the column values.
* *
* <p>The meta data processing is based on the DatabaseMetaData provided by the * <p>The meta-data processing is based on the DatabaseMetaData provided by the
* JDBC driver. As long as the JDBC driver can provide the names of the columns * JDBC driver. As long as the JDBC driver can provide the names of the columns
* for a specified table than we can rely on this auto-detection feature. If that * for a specified table than we can rely on this auto-detection feature. If that
* is not the case, then the column names must be specified explicitly. * is not the case, then the column names must be specified explicitly.
* *
* <p>The actual insert is being handled using Spring's * <p>The actual insert is being handled using Spring's {@link JdbcTemplate}.
* {@link org.springframework.jdbc.core.JdbcTemplate}.
* *
* <p>Many of the configuration methods return the current instance of the SimpleJdbcInsert * <p>Many of the configuration methods return the current instance of the
* to provide the ability to chain multiple ones together in a "fluent" interface style. * SimpleJdbcInsert to provide the ability to chain multiple ones together
* in a "fluent" interface style.
* *
* @author Thomas Risberg * @author Thomas Risberg
* @author Juergen Hoeller
* @since 2.5 * @since 2.5
* @see java.sql.DatabaseMetaData * @see java.sql.DatabaseMetaData
* @see org.springframework.jdbc.core.JdbcTemplate * @see org.springframework.jdbc.core.JdbcTemplate

View File

@ -67,13 +67,13 @@ public interface SimpleJdbcInsertOperations {
SimpleJdbcInsertOperations usingGeneratedKeyColumns(String... columnNames); SimpleJdbcInsertOperations usingGeneratedKeyColumns(String... columnNames);
/** /**
* Turn off any processing of column meta data information obtained via JDBC. * Turn off any processing of column meta-data information obtained via JDBC.
* @return the instance of this SimpleJdbcInsert * @return the instance of this SimpleJdbcInsert
*/ */
SimpleJdbcInsertOperations withoutTableColumnMetaDataAccess(); SimpleJdbcInsertOperations withoutTableColumnMetaDataAccess();
/** /**
* Include synonyms for the column meta data lookups via JDBC. * Include synonyms for the column meta-data lookups via JDBC.
* <p>Note: This is only necessary to include for Oracle since other databases * <p>Note: This is only necessary to include for Oracle since other databases
* supporting synonyms seems to include the synonyms automatically. * supporting synonyms seems to include the synonyms automatically.
* @return the instance of this SimpleJdbcInsert * @return the instance of this SimpleJdbcInsert

View File

@ -1,9 +1,9 @@
/** /**
* Simplification layer over JdbcTemplate for Java 5 and above. * Simplification layer for table inserts and stored procedure calls.
* *
* <p>{@code SimpleJdbcInsert} and {@code SimpleJdbcCall} are classes that takes advantage * <p>{@code SimpleJdbcInsert} and {@code SimpleJdbcCall} take advantage of database
* of database metadata provided by the JDBC driver to simplify the application code. Much of the * meta-data 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. * parameter specification becomes unnecessary since it can be looked up in the meta-data.
*/ */
@NonNullApi @NonNullApi
@NonNullFields @NonNullFields

View File

@ -21,7 +21,7 @@ import java.sql.SQLException;
/** /**
* A callback interface used by the JdbcUtils class. Implementations of this * A callback interface used by the JdbcUtils class. Implementations of this
* interface perform the actual work of extracting database meta data, but * interface perform the actual work of extracting database meta-data, but
* don't need to worry about exception handling. SQLExceptions will be caught * don't need to worry about exception handling. SQLExceptions will be caught
* and handled correctly by the JdbcUtils class. * and handled correctly by the JdbcUtils class.
* *
@ -32,15 +32,15 @@ import java.sql.SQLException;
public interface DatabaseMetaDataCallback { public interface DatabaseMetaDataCallback {
/** /**
* Implementations must implement this method to process the meta data * Implementations must implement this method to process the meta-data
* passed in. Exactly what the implementation chooses to do is up to it. * passed in. Exactly what the implementation chooses to do is up to it.
* @param dbmd the DatabaseMetaData to process * @param dbmd the DatabaseMetaData to process
* @return a result object extracted from the meta data * @return a result object extracted from the meta-data
* (can be an arbitrary object, as needed by the implementation) * (can be an arbitrary object, as needed by the implementation)
* @throws SQLException if a SQLException is encountered getting * @throws SQLException if a SQLException is encountered getting
* column values (that is, there's no need to catch SQLException) * column values (that is, there's no need to catch SQLException)
* @throws MetaDataAccessException in case of other failures while * @throws MetaDataAccessException in case of other failures while
* extracting meta data (for example, reflection failure) * extracting meta-data (for example, reflection failure)
*/ */
Object processMetaData(DatabaseMetaData dbmd) throws SQLException, MetaDataAccessException; Object processMetaData(DatabaseMetaData dbmd) throws SQLException, MetaDataAccessException;

View File

@ -81,7 +81,7 @@ public abstract class JdbcAccessor implements InitializingBean {
/** /**
* Specify the database product name for the DataSource that this accessor uses. * Specify the database product name for the DataSource that this accessor uses.
* This allows to initialize a SQLErrorCodeSQLExceptionTranslator without * This allows to initialize a SQLErrorCodeSQLExceptionTranslator without
* obtaining a Connection from the DataSource to get the metadata. * obtaining a Connection from the DataSource to get the meta-data.
* @param dbName the database product name that identifies the error codes entry * @param dbName the database product name that identifies the error codes entry
* @see SQLErrorCodeSQLExceptionTranslator#setDatabaseProductName * @see SQLErrorCodeSQLExceptionTranslator#setDatabaseProductName
* @see java.sql.DatabaseMetaData#getDatabaseProductName() * @see java.sql.DatabaseMetaData#getDatabaseProductName()

View File

@ -296,19 +296,19 @@ public abstract class JdbcUtils {
} }
/** /**
* Extract database meta data via the given DatabaseMetaDataCallback. * Extract database meta-data via the given DatabaseMetaDataCallback.
* <p>This method will open a connection to the database and retrieve the database metadata. * <p>This method will open a connection to the database and retrieve the database meta-data.
* Since this method is called before the exception translation feature is configured for * Since this method is called before the exception translation feature is configured for
* a datasource, this method can not rely on the SQLException translation functionality. * a datasource, this method can not rely on the SQLException translation functionality.
* <p>Any exceptions will be wrapped in a MetaDataAccessException. This is a checked exception * <p>Any exceptions will be wrapped in a MetaDataAccessException. This is a checked exception
* and any calling code should catch and handle this exception. You can just log the * and any calling code should catch and handle this exception. You can just log the
* error and hope for the best, but there is probably a more serious error that will * error and hope for the best, but there is probably a more serious error that will
* reappear when you try to access the database again. * reappear when you try to access the database again.
* @param dataSource the DataSource to extract metadata for * @param dataSource the DataSource to extract meta-data for
* @param action callback that will do the actual work * @param action callback that will do the actual work
* @return object containing the extracted information, as returned by * @return object containing the extracted information, as returned by
* the DatabaseMetaDataCallback's {@code processMetaData} method * the DatabaseMetaDataCallback's {@code processMetaData} method
* @throws MetaDataAccessException if meta data access failed * @throws MetaDataAccessException if meta-data access failed
*/ */
public static Object extractDatabaseMetaData(DataSource dataSource, DatabaseMetaDataCallback action) public static Object extractDatabaseMetaData(DataSource dataSource, DatabaseMetaDataCallback action)
throws MetaDataAccessException { throws MetaDataAccessException {
@ -324,7 +324,7 @@ public abstract class JdbcUtils {
return action.processMetaData(metaData); return action.processMetaData(metaData);
} }
catch (CannotGetJdbcConnectionException ex) { catch (CannotGetJdbcConnectionException ex) {
throw new MetaDataAccessException("Could not get Connection for extracting meta data", ex); throw new MetaDataAccessException("Could not get Connection for extracting meta-data", ex);
} }
catch (SQLException ex) { catch (SQLException ex) {
throw new MetaDataAccessException("Error while extracting DatabaseMetaData", ex); throw new MetaDataAccessException("Error while extracting DatabaseMetaData", ex);
@ -341,7 +341,7 @@ public abstract class JdbcUtils {
/** /**
* Call the specified method on DatabaseMetaData for the given DataSource, * Call the specified method on DatabaseMetaData for the given DataSource,
* and extract the invocation result. * and extract the invocation result.
* @param dataSource the DataSource to extract meta data for * @param dataSource the DataSource to extract meta-data for
* @param metaDataMethodName the name of the DatabaseMetaData method to call * @param metaDataMethodName the name of the DatabaseMetaData method to call
* @return the object returned by the specified DatabaseMetaData method * @return the object returned by the specified DatabaseMetaData method
* @throws MetaDataAccessException if we couldn't access the DatabaseMetaData * @throws MetaDataAccessException if we couldn't access the DatabaseMetaData
@ -408,7 +408,7 @@ public abstract class JdbcUtils {
/** /**
* Extract a common name for the target database in use even if * Extract a common name for the target database in use even if
* various drivers/platforms provide varying names at runtime. * various drivers/platforms provide varying names at runtime.
* @param source the name as provided in database metadata * @param source the name as provided in database meta-data
* @return the common name to be used (e.g. "DB2" or "Sybase") * @return the common name to be used (e.g. "DB2" or "Sybase")
*/ */
@Nullable @Nullable
@ -446,7 +446,7 @@ public abstract class JdbcUtils {
* <p><i>columnLabel - the label for the column specified with the SQL AS clause. * <p><i>columnLabel - the label for the column specified with the SQL AS clause.
* If the SQL AS clause was not specified, then the label is the name of the column</i>. * If the SQL AS clause was not specified, then the label is the name of the column</i>.
* @return the column name to use * @return the column name to use
* @param resultSetMetaData the current meta data to use * @param resultSetMetaData the current meta-data to use
* @param columnIndex the index of the column for the look up * @param columnIndex the index of the column for the look up
* @throws SQLException in case of lookup failure * @throws SQLException in case of lookup failure
*/ */

View File

@ -19,11 +19,11 @@ package org.springframework.jdbc.support;
import org.springframework.core.NestedCheckedException; import org.springframework.core.NestedCheckedException;
/** /**
* Exception indicating that something went wrong during JDBC metadata lookup. * Exception indicating that something went wrong during JDBC meta-data lookup.
* *
* <p>This is a checked exception since we want it to be caught, logged and * <p>This is a checked exception since we want it to be caught, logged and
* handled rather than cause the application to fail. Failure to read JDBC * handled rather than cause the application to fail. Failure to read JDBC
* metadata is usually not a fatal problem. * meta-data is usually not a fatal problem.
* *
* @author Thomas Risberg * @author Thomas Risberg
* @since 1.0.1 * @since 1.0.1

View File

@ -45,7 +45,7 @@ import org.springframework.lang.Nullable;
* concrete and is typically used itself, in which case this rule doesn't apply. * concrete and is typically used itself, in which case this rule doesn't apply.
* <li>Apply error code matching. Error codes are obtained from the SQLErrorCodesFactory * <li>Apply error code matching. Error codes are obtained from the SQLErrorCodesFactory
* by default. This factory loads a "sql-error-codes.xml" file from the class path, * by default. This factory loads a "sql-error-codes.xml" file from the class path,
* defining error code mappings for database names from database metadata. * defining error code mappings for database names from database meta-data.
* <li>Fallback to a fallback translator. {@link SQLStateSQLExceptionTranslator} is the * <li>Fallback to a fallback translator. {@link SQLStateSQLExceptionTranslator} is the
* default fallback translator, analyzing the exception's SQL state only. On Java 6 * default fallback translator, analyzing the exception's SQL state only. On Java 6
* which introduces its own {@code SQLException} subclass hierarchy, we will * which introduces its own {@code SQLException} subclass hierarchy, we will
@ -89,8 +89,8 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
/** /**
* Create a SQL error code translator for the given DataSource. * Create a SQL error code translator for the given DataSource.
* Invoking this constructor will cause a Connection to be obtained * Invoking this constructor will cause a Connection to be obtained
* from the DataSource to get the metadata. * from the DataSource to get the meta-data.
* @param dataSource DataSource to use to find metadata and establish * @param dataSource DataSource to use to find meta-data and establish
* which error codes are usable * which error codes are usable
* @see SQLErrorCodesFactory * @see SQLErrorCodesFactory
*/ */
@ -102,7 +102,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
/** /**
* Create a SQL error code translator for the given database product name. * Create a SQL error code translator for the given database product name.
* Invoking this constructor will avoid obtaining a Connection from the * Invoking this constructor will avoid obtaining a Connection from the
* DataSource to get the metadata. * DataSource to get the meta-data.
* @param dbName the database product name that identifies the error codes entry * @param dbName the database product name that identifies the error codes entry
* @see SQLErrorCodesFactory * @see SQLErrorCodesFactory
* @see java.sql.DatabaseMetaData#getDatabaseProductName() * @see java.sql.DatabaseMetaData#getDatabaseProductName()
@ -114,7 +114,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
/** /**
* Create a SQLErrorCode translator given these error codes. * Create a SQLErrorCode translator given these error codes.
* Does not require a database metadata lookup to be performed using a connection. * Does not require a database meta-data lookup to be performed using a connection.
* @param sec error codes * @param sec error codes
*/ */
public SQLErrorCodeSQLExceptionTranslator(SQLErrorCodes sec) { public SQLErrorCodeSQLExceptionTranslator(SQLErrorCodes sec) {
@ -126,8 +126,8 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
/** /**
* Set the DataSource for this translator. * Set the DataSource for this translator.
* <p>Setting this property will cause a Connection to be obtained from * <p>Setting this property will cause a Connection to be obtained from
* the DataSource to get the metadata. * the DataSource to get the meta-data.
* @param dataSource DataSource to use to find metadata and establish * @param dataSource DataSource to use to find meta-data and establish
* which error codes are usable * which error codes are usable
* @see SQLErrorCodesFactory#getErrorCodes(javax.sql.DataSource) * @see SQLErrorCodesFactory#getErrorCodes(javax.sql.DataSource)
* @see java.sql.DatabaseMetaData#getDatabaseProductName() * @see java.sql.DatabaseMetaData#getDatabaseProductName()
@ -139,7 +139,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
/** /**
* Set the database product name for this translator. * Set the database product name for this translator.
* <p>Setting this property will avoid obtaining a Connection from the DataSource * <p>Setting this property will avoid obtaining a Connection from the DataSource
* to get the metadata. * to get the meta-data.
* @param dbName the database product name that identifies the error codes entry * @param dbName the database product name that identifies the error codes entry
* @see SQLErrorCodesFactory#getErrorCodes(String) * @see SQLErrorCodesFactory#getErrorCodes(String)
* @see java.sql.DatabaseMetaData#getDatabaseProductName() * @see java.sql.DatabaseMetaData#getDatabaseProductName()

View File

@ -155,7 +155,7 @@ public class SQLErrorCodesFactory {
/** /**
* Return the {@link SQLErrorCodes} instance for the given database. * Return the {@link SQLErrorCodes} instance for the given database.
* <p>No need for a database metadata lookup. * <p>No need for a database meta-data lookup.
* @param databaseName the database name (must not be {@code null}) * @param databaseName the database name (must not be {@code null})
* @return the {@code SQLErrorCodes} instance for the given database * @return the {@code SQLErrorCodes} instance for the given database
* @throws IllegalArgumentException if the supplied database name is {@code null} * @throws IllegalArgumentException if the supplied database name is {@code null}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,18 +27,17 @@ import java.util.Map;
import org.springframework.jdbc.InvalidResultSetAccessException; import org.springframework.jdbc.InvalidResultSetAccessException;
/** /**
* Mirror interface for {@link javax.sql.RowSet}, representing * Mirror interface for {@link javax.sql.RowSet}, representing a disconnected variant of
* disconnected {@link java.sql.ResultSet} data. * {@link java.sql.ResultSet} data.
* *
* <p>The main difference to the standard JDBC RowSet is that a * <p>The main difference to the standard JDBC RowSet is that a {@link java.sql.SQLException}
* {@link java.sql.SQLException} is never thrown here. This allows a * is never thrown here. This allows a SqlRowSet to be used without having to deal with
* SqlRowSet to be used without having to deal with checked exceptions. * checked exceptions. A SqlRowSet will throw Spring's {@link InvalidResultSetAccessException}
* A SqlRowSet will throw Spring's {@link InvalidResultSetAccessException}
* instead (when appropriate). * instead (when appropriate).
* *
* <p>Note: This interface extends the {@code java.io.Serializable} marker * <p>Note: This interface extends the {@code java.io.Serializable} marker interface.
* interface. Implementations, which typically hold disconnected data, * Implementations, which typically hold disconnected data, are encouraged to be actually
* are encouraged to be actually serializable (as far as possible). * serializable (as far as possible).
* *
* @author Thomas Risberg * @author Thomas Risberg
* @author Juergen Hoeller * @author Juergen Hoeller
@ -51,7 +50,7 @@ import org.springframework.jdbc.InvalidResultSetAccessException;
public interface SqlRowSet extends Serializable { public interface SqlRowSet extends Serializable {
/** /**
* Retrieve the meta data, i.e. number, types and properties * Retrieve the meta-data, i.e. number, types and properties
* for the columns of this row set. * for the columns of this row set.
* @return a corresponding SqlRowSetMetaData instance * @return a corresponding SqlRowSetMetaData instance
* @see java.sql.ResultSet#getMetaData() * @see java.sql.ResultSet#getMetaData()
@ -70,8 +69,7 @@ public interface SqlRowSet extends Serializable {
// RowSet methods for extracting data values // RowSet methods for extracting data values
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a BigDecimal object.
* as a BigDecimal object.
* @param columnIndex the column index * @param columnIndex the column index
* @return an BigDecimal object representing the column value * @return an BigDecimal object representing the column value
* @see java.sql.ResultSet#getBigDecimal(int) * @see java.sql.ResultSet#getBigDecimal(int)
@ -79,8 +77,7 @@ public interface SqlRowSet extends Serializable {
BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException; BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a BigDecimal object.
* as a BigDecimal object.
* @param columnLabel the column label * @param columnLabel the column label
* @return an BigDecimal object representing the column value * @return an BigDecimal object representing the column value
* @see java.sql.ResultSet#getBigDecimal(String) * @see java.sql.ResultSet#getBigDecimal(String)
@ -88,8 +85,7 @@ public interface SqlRowSet extends Serializable {
BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException; BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a boolean.
* as a boolean.
* @param columnIndex the column index * @param columnIndex the column index
* @return a boolean representing the column value * @return a boolean representing the column value
* @see java.sql.ResultSet#getBoolean(int) * @see java.sql.ResultSet#getBoolean(int)
@ -97,8 +93,7 @@ public interface SqlRowSet extends Serializable {
boolean getBoolean(int columnIndex) throws InvalidResultSetAccessException; boolean getBoolean(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a boolean.
* as a boolean.
* @param columnLabel the column label * @param columnLabel the column label
* @return a boolean representing the column value * @return a boolean representing the column value
* @see java.sql.ResultSet#getBoolean(String) * @see java.sql.ResultSet#getBoolean(String)
@ -106,8 +101,7 @@ public interface SqlRowSet extends Serializable {
boolean getBoolean(String columnLabel) throws InvalidResultSetAccessException; boolean getBoolean(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a byte.
* as a byte.
* @param columnIndex the column index * @param columnIndex the column index
* @return a byte representing the column value * @return a byte representing the column value
* @see java.sql.ResultSet#getByte(int) * @see java.sql.ResultSet#getByte(int)
@ -115,8 +109,7 @@ public interface SqlRowSet extends Serializable {
byte getByte(int columnIndex) throws InvalidResultSetAccessException; byte getByte(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a byte.
* as a byte.
* @param columnLabel the column label * @param columnLabel the column label
* @return a byte representing the column value * @return a byte representing the column value
* @see java.sql.ResultSet#getByte(String) * @see java.sql.ResultSet#getByte(String)
@ -124,8 +117,7 @@ public interface SqlRowSet extends Serializable {
byte getByte(String columnLabel) throws InvalidResultSetAccessException; byte getByte(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Date object.
* as a Date object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Date object representing the column value * @return a Date object representing the column value
* @see java.sql.ResultSet#getDate(int) * @see java.sql.ResultSet#getDate(int)
@ -133,8 +125,7 @@ public interface SqlRowSet extends Serializable {
Date getDate(int columnIndex) throws InvalidResultSetAccessException; Date getDate(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Date object.
* as a Date object.
* @param columnLabel the column label * @param columnLabel the column label
* @return a Date object representing the column value * @return a Date object representing the column value
* @see java.sql.ResultSet#getDate(String) * @see java.sql.ResultSet#getDate(String)
@ -142,8 +133,7 @@ public interface SqlRowSet extends Serializable {
Date getDate(String columnLabel) throws InvalidResultSetAccessException; Date getDate(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Date object.
* as a Date object.
* @param columnIndex the column index * @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Date object representing the column value * @return a Date object representing the column value
@ -152,8 +142,7 @@ public interface SqlRowSet extends Serializable {
Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException; Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Date object.
* as a Date object.
* @param columnLabel the column label * @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Date object representing the column value * @return a Date object representing the column value
@ -162,8 +151,7 @@ public interface SqlRowSet extends Serializable {
Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException; Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Double object.
* as a Double object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Double object representing the column value * @return a Double object representing the column value
* @see java.sql.ResultSet#getDouble(int) * @see java.sql.ResultSet#getDouble(int)
@ -171,8 +159,7 @@ public interface SqlRowSet extends Serializable {
double getDouble(int columnIndex) throws InvalidResultSetAccessException; double getDouble(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Double object.
* as a Double object.
* @param columnLabel the column label * @param columnLabel the column label
* @return a Double object representing the column value * @return a Double object representing the column value
* @see java.sql.ResultSet#getDouble(String) * @see java.sql.ResultSet#getDouble(String)
@ -180,8 +167,7 @@ public interface SqlRowSet extends Serializable {
double getDouble(String columnLabel) throws InvalidResultSetAccessException; double getDouble(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a float.
* as a float.
* @param columnIndex the column index * @param columnIndex the column index
* @return a float representing the column value * @return a float representing the column value
* @see java.sql.ResultSet#getFloat(int) * @see java.sql.ResultSet#getFloat(int)
@ -189,8 +175,7 @@ public interface SqlRowSet extends Serializable {
float getFloat(int columnIndex) throws InvalidResultSetAccessException; float getFloat(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a float.
* as a float.
* @param columnLabel the column label * @param columnLabel the column label
* @return a float representing the column value * @return a float representing the column value
* @see java.sql.ResultSet#getFloat(String) * @see java.sql.ResultSet#getFloat(String)
@ -198,8 +183,7 @@ public interface SqlRowSet extends Serializable {
float getFloat(String columnLabel) throws InvalidResultSetAccessException; float getFloat(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as an int.
* as an int.
* @param columnIndex the column index * @param columnIndex the column index
* @return an int representing the column value * @return an int representing the column value
* @see java.sql.ResultSet#getInt(int) * @see java.sql.ResultSet#getInt(int)
@ -207,8 +191,7 @@ public interface SqlRowSet extends Serializable {
int getInt(int columnIndex) throws InvalidResultSetAccessException; int getInt(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as an int.
* as an int.
* @param columnLabel the column label * @param columnLabel the column label
* @return an int representing the column value * @return an int representing the column value
* @see java.sql.ResultSet#getInt(String) * @see java.sql.ResultSet#getInt(String)
@ -216,8 +199,7 @@ public interface SqlRowSet extends Serializable {
int getInt(String columnLabel) throws InvalidResultSetAccessException; int getInt(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a long.
* as a long.
* @param columnIndex the column index * @param columnIndex the column index
* @return a long representing the column value * @return a long representing the column value
* @see java.sql.ResultSet#getLong(int) * @see java.sql.ResultSet#getLong(int)
@ -225,8 +207,7 @@ public interface SqlRowSet extends Serializable {
long getLong(int columnIndex) throws InvalidResultSetAccessException; long getLong(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a long.
* as a long.
* @param columnLabel the column label * @param columnLabel the column label
* @return a long representing the column value * @return a long representing the column value
* @see java.sql.ResultSet#getLong(String) * @see java.sql.ResultSet#getLong(String)
@ -234,8 +215,8 @@ public interface SqlRowSet extends Serializable {
long getLong(String columnLabel) throws InvalidResultSetAccessException; long getLong(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a String
* as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns). * (for NCHAR, NVARCHAR, LONGNVARCHAR columns).
* @param columnIndex the column index * @param columnIndex the column index
* @return a String representing the column value * @return a String representing the column value
* @see java.sql.ResultSet#getNString(int) * @see java.sql.ResultSet#getNString(int)
@ -244,8 +225,8 @@ public interface SqlRowSet extends Serializable {
String getNString(int columnIndex) throws InvalidResultSetAccessException; String getNString(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a String
* as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns). * (for NCHAR, NVARCHAR, LONGNVARCHAR columns).
* @param columnLabel the column label * @param columnLabel the column label
* @return a String representing the column value * @return a String representing the column value
* @see java.sql.ResultSet#getNString(String) * @see java.sql.ResultSet#getNString(String)
@ -254,8 +235,7 @@ public interface SqlRowSet extends Serializable {
String getNString(String columnLabel) throws InvalidResultSetAccessException; String getNString(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as an Object.
* as an Object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Object representing the column value * @return a Object representing the column value
* @see java.sql.ResultSet#getObject(int) * @see java.sql.ResultSet#getObject(int)
@ -263,8 +243,7 @@ public interface SqlRowSet extends Serializable {
Object getObject(int columnIndex) throws InvalidResultSetAccessException; Object getObject(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as an Object.
* as an Object.
* @param columnLabel the column label * @param columnLabel the column label
* @return a Object representing the column value * @return a Object representing the column value
* @see java.sql.ResultSet#getObject(String) * @see java.sql.ResultSet#getObject(String)
@ -272,8 +251,7 @@ public interface SqlRowSet extends Serializable {
Object getObject(String columnLabel) throws InvalidResultSetAccessException; Object getObject(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as an Object.
* as an Object.
* @param columnIndex the column index * @param columnIndex the column index
* @param map a Map object containing the mapping from SQL types to Java types * @param map a Map object containing the mapping from SQL types to Java types
* @return a Object representing the column value * @return a Object representing the column value
@ -282,8 +260,7 @@ public interface SqlRowSet extends Serializable {
Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException; Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as an Object.
* as an Object.
* @param columnLabel the column label * @param columnLabel the column label
* @param map a Map object containing the mapping from SQL types to Java types * @param map a Map object containing the mapping from SQL types to Java types
* @return a Object representing the column value * @return a Object representing the column value
@ -292,8 +269,7 @@ public interface SqlRowSet extends Serializable {
Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException; Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as an Object.
* as an Object.
* @param columnIndex the column index * @param columnIndex the column index
* @param type the Java type to convert the designated column to * @param type the Java type to convert the designated column to
* @return a Object representing the column value * @return a Object representing the column value
@ -303,8 +279,7 @@ public interface SqlRowSet extends Serializable {
<T> T getObject(int columnIndex, Class<T> type) throws InvalidResultSetAccessException; <T> T getObject(int columnIndex, Class<T> type) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as an Object.
* as an Object.
* @param columnLabel the column label * @param columnLabel the column label
* @param type the Java type to convert the designated column to * @param type the Java type to convert the designated column to
* @return a Object representing the column value * @return a Object representing the column value
@ -314,8 +289,7 @@ public interface SqlRowSet extends Serializable {
<T> T getObject(String columnLabel, Class<T> type) throws InvalidResultSetAccessException; <T> T getObject(String columnLabel, Class<T> type) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a short.
* as a short.
* @param columnIndex the column index * @param columnIndex the column index
* @return a short representing the column value * @return a short representing the column value
* @see java.sql.ResultSet#getShort(int) * @see java.sql.ResultSet#getShort(int)
@ -323,8 +297,7 @@ public interface SqlRowSet extends Serializable {
short getShort(int columnIndex) throws InvalidResultSetAccessException; short getShort(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a short.
* as a short.
* @param columnLabel the column label * @param columnLabel the column label
* @return a short representing the column value * @return a short representing the column value
* @see java.sql.ResultSet#getShort(String) * @see java.sql.ResultSet#getShort(String)
@ -332,8 +305,7 @@ public interface SqlRowSet extends Serializable {
short getShort(String columnLabel) throws InvalidResultSetAccessException; short getShort(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a String.
* as a String.
* @param columnIndex the column index * @param columnIndex the column index
* @return a String representing the column value * @return a String representing the column value
* @see java.sql.ResultSet#getString(int) * @see java.sql.ResultSet#getString(int)
@ -341,8 +313,7 @@ public interface SqlRowSet extends Serializable {
String getString(int columnIndex) throws InvalidResultSetAccessException; String getString(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a String.
* as a String.
* @param columnLabel the column label * @param columnLabel the column label
* @return a String representing the column value * @return a String representing the column value
* @see java.sql.ResultSet#getString(String) * @see java.sql.ResultSet#getString(String)
@ -350,8 +321,7 @@ public interface SqlRowSet extends Serializable {
String getString(String columnLabel) throws InvalidResultSetAccessException; String getString(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Time object.
* as a Time object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Time object representing the column value * @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(int) * @see java.sql.ResultSet#getTime(int)
@ -359,8 +329,7 @@ public interface SqlRowSet extends Serializable {
Time getTime(int columnIndex) throws InvalidResultSetAccessException; Time getTime(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Time object.
* as a Time object.
* @param columnLabel the column label * @param columnLabel the column label
* @return a Time object representing the column value * @return a Time object representing the column value
* @see java.sql.ResultSet#getTime(String) * @see java.sql.ResultSet#getTime(String)
@ -368,8 +337,7 @@ public interface SqlRowSet extends Serializable {
Time getTime(String columnLabel) throws InvalidResultSetAccessException; Time getTime(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Time object.
* as a Time object.
* @param columnIndex the column index * @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Time object representing the column value * @return a Time object representing the column value
@ -378,8 +346,7 @@ public interface SqlRowSet extends Serializable {
Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException; Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Time object.
* as a Time object.
* @param columnLabel the column label * @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Time object representing the column value * @return a Time object representing the column value
@ -388,8 +355,7 @@ public interface SqlRowSet extends Serializable {
Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException; Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Timestamp object.
* as a Timestamp object.
* @param columnIndex the column index * @param columnIndex the column index
* @return a Timestamp object representing the column value * @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(int) * @see java.sql.ResultSet#getTimestamp(int)
@ -397,8 +363,7 @@ public interface SqlRowSet extends Serializable {
Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException; Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Timestamp object.
* as a Timestamp object.
* @param columnLabel the column label * @param columnLabel the column label
* @return a Timestamp object representing the column value * @return a Timestamp object representing the column value
* @see java.sql.ResultSet#getTimestamp(String) * @see java.sql.ResultSet#getTimestamp(String)
@ -406,8 +371,7 @@ public interface SqlRowSet extends Serializable {
Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException; Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Timestamp object.
* as a Timestamp object.
* @param columnIndex the column index * @param columnIndex the column index
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Timestamp object representing the column value * @return a Timestamp object representing the column value
@ -416,8 +380,7 @@ public interface SqlRowSet extends Serializable {
Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException; Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException;
/** /**
* Retrieve the value of the indicated column in the current row * Retrieve the value of the indicated column in the current row as a Timestamp object.
* as a Timestamp object.
* @param columnLabel the column label * @param columnLabel the column label
* @param cal the Calendar to use in constructing the Date * @param cal the Calendar to use in constructing the Date
* @return a Timestamp object representing the column value * @return a Timestamp object representing the column value
@ -429,11 +392,9 @@ public interface SqlRowSet extends Serializable {
// RowSet navigation methods // RowSet navigation methods
/** /**
* Move the cursor to the given row number in the row set, * Move the cursor to the given row number in the row set, just after the last row.
* just after the last row.
* @param row the number of the row where the cursor should move * @param row the number of the row where the cursor should move
* @return {@code true} if the cursor is on the row set, * @return {@code true} if the cursor is on the row set, {@code false} otherwise
* {@code false} otherwise
* @see java.sql.ResultSet#absolute(int) * @see java.sql.ResultSet#absolute(int)
*/ */
boolean absolute(int row) throws InvalidResultSetAccessException; boolean absolute(int row) throws InvalidResultSetAccessException;
@ -445,16 +406,14 @@ public interface SqlRowSet extends Serializable {
void afterLast() throws InvalidResultSetAccessException; void afterLast() throws InvalidResultSetAccessException;
/** /**
* Move the cursor to the front of this row set, * Move the cursor to the front of this row set, just before the first row.
* just before the first row.
* @see java.sql.ResultSet#beforeFirst() * @see java.sql.ResultSet#beforeFirst()
*/ */
void beforeFirst() throws InvalidResultSetAccessException; void beforeFirst() throws InvalidResultSetAccessException;
/** /**
* Move the cursor to the first row of this row set. * Move the cursor to the first row of this row set.
* @return {@code true} if the cursor is on a valid row, * @return {@code true} if the cursor is on a valid row, {@code false} otherwise
* {@code false} otherwise
* @see java.sql.ResultSet#first() * @see java.sql.ResultSet#first()
*/ */
boolean first() throws InvalidResultSetAccessException; boolean first() throws InvalidResultSetAccessException;
@ -468,74 +427,65 @@ public interface SqlRowSet extends Serializable {
/** /**
* Retrieve whether the cursor is after the last row of this row set. * Retrieve whether the cursor is after the last row of this row set.
* @return {@code true} if the cursor is after the last row, * @return {@code true} if the cursor is after the last row, {@code false} otherwise
* {@code false} otherwise
* @see java.sql.ResultSet#isAfterLast() * @see java.sql.ResultSet#isAfterLast()
*/ */
boolean isAfterLast() throws InvalidResultSetAccessException; boolean isAfterLast() throws InvalidResultSetAccessException;
/** /**
* Retrieve whether the cursor is before the first row of this row set. * Retrieve whether the cursor is before the first row of this row set.
* @return {@code true} if the cursor is before the first row, * @return {@code true} if the cursor is before the first row, {@code false} otherwise
* {@code false} otherwise
* @see java.sql.ResultSet#isBeforeFirst() * @see java.sql.ResultSet#isBeforeFirst()
*/ */
boolean isBeforeFirst() throws InvalidResultSetAccessException; boolean isBeforeFirst() throws InvalidResultSetAccessException;
/** /**
* Retrieve whether the cursor is on the first row of this row set. * Retrieve whether the cursor is on the first row of this row set.
* @return {@code true} if the cursor is after the first row, * @return {@code true} if the cursor is after the first row, {@code false} otherwise
* {@code false} otherwise
* @see java.sql.ResultSet#isFirst() * @see java.sql.ResultSet#isFirst()
*/ */
boolean isFirst() throws InvalidResultSetAccessException; boolean isFirst() throws InvalidResultSetAccessException;
/** /**
* Retrieve whether the cursor is on the last row of this row set. * Retrieve whether the cursor is on the last row of this row set.
* @return {@code true} if the cursor is after the last row, * @return {@code true} if the cursor is after the last row, {@code false} otherwise
* {@code false} otherwise
* @see java.sql.ResultSet#isLast() * @see java.sql.ResultSet#isLast()
*/ */
boolean isLast() throws InvalidResultSetAccessException; boolean isLast() throws InvalidResultSetAccessException;
/** /**
* Move the cursor to the last row of this row set. * Move the cursor to the last row of this row set.
* @return {@code true} if the cursor is on a valid row, * @return {@code true} if the cursor is on a valid row, {@code false} otherwise
* {@code false} otherwise
* @see java.sql.ResultSet#last() * @see java.sql.ResultSet#last()
*/ */
boolean last() throws InvalidResultSetAccessException; boolean last() throws InvalidResultSetAccessException;
/** /**
* Move the cursor to the next row. * Move the cursor to the next row.
* @return {@code true} if the new row is valid, * @return {@code true} if the new row is valid, {@code false} if there are no more rows
* {@code false} if there are no more rows
* @see java.sql.ResultSet#next() * @see java.sql.ResultSet#next()
*/ */
boolean next() throws InvalidResultSetAccessException; boolean next() throws InvalidResultSetAccessException;
/** /**
* Move the cursor to the previous row. * Move the cursor to the previous row.
* @return {@code true} if the new row is valid, * @return {@code true} if the new row is valid, {@code false} if it is off the row set
* {@code false} if it is off the row set
* @see java.sql.ResultSet#previous() * @see java.sql.ResultSet#previous()
*/ */
boolean previous() throws InvalidResultSetAccessException; boolean previous() throws InvalidResultSetAccessException;
/** /**
* Move the cursor a relative number of rows, * Move the cursor a relative number of rows, either positive or negative.
* either positive or negative. * @return {@code true} if the cursor is on a row, {@code false} otherwise
* @return {@code true} if the cursor is on a row,
* {@code false} otherwise
* @see java.sql.ResultSet#relative(int) * @see java.sql.ResultSet#relative(int)
*/ */
boolean relative(int rows) throws InvalidResultSetAccessException; boolean relative(int rows) throws InvalidResultSetAccessException;
/** /**
* Report whether the last column read had a value of SQL {@code NULL}. * 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 * <p>Note that you must first call one of the getter methods and then
* and then call the {@code wasNull()} method. * call the {@code wasNull()} method.
* @return {@code true} if the most recent coumn retrieved was * @return {@code true} if the most recent column retrieved was
* SQL {@code NULL}, {@code false} otherwise * SQL {@code NULL}, {@code false} otherwise
* @see java.sql.ResultSet#wasNull() * @see java.sql.ResultSet#wasNull()
*/ */