Polishing

This commit is contained in:
Juergen Hoeller
2017-02-16 14:20:40 +01:00
parent 7ed4884eaa
commit b0ef80c3ff
30 changed files with 203 additions and 238 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2017 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.
@@ -233,10 +233,7 @@ public class CallableStatementCreatorFactory {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("CallableStatementCreatorFactory.CallableStatementCreatorImpl: sql=[");
sb.append(callString).append("]; parameters=").append(this.inParameters);
return sb.toString();
return "CallableStatementCreator: sql=[" + callString + "]; parameters=" + this.inParameters;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@@ -306,10 +306,7 @@ public class PreparedStatementCreatorFactory {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("PreparedStatementCreatorFactory.PreparedStatementCreatorImpl: sql=[");
sb.append(sql).append("]; parameters=").append(this.parameters);
return sb.toString();
return "PreparedStatementCreator: sql=[" + sql + "]; parameters=" + this.parameters;
}
}

View File

@@ -45,8 +45,8 @@ public interface CallMetaDataProvider {
* 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.
* @param databaseMetaData used to retrieve database specific information
* @param catalogName name of catalog to use or null
* @param schemaName name of schema name to use or null
* @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 procedureName name of the stored procedure
* @throws SQLException in case of initialization failure
* @see org.springframework.jdbc.core.simple.SimpleJdbcCall#withoutProcedureColumnMetaDataAccess()

View File

@@ -79,8 +79,8 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
/**
* Constructor used to initialize with provided database meta data.
* @param databaseMetaData meta data to be used
* Constructor used to initialize with provided database metadata.
* @param databaseMetaData metadata to be used
*/
protected GenericTableMetaDataProvider(DatabaseMetaData databaseMetaData) throws SQLException {
this.userName = databaseMetaData.getUserName();
@@ -308,7 +308,7 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
}
/**
* Method supporting the metedata processing for a table.
* Method supporting the metadata processing for a table.
*/
private void locateTableAndProcessMetaData(
DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String tableName) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 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.
@@ -23,8 +23,8 @@ import java.util.List;
import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor;
/**
* Interface specifying the API to be implemented by a class providing table metedata. This is intended for internal use
* by the Simple JDBC classes.
* Interface specifying the API to be implemented by a class providing table metadata.
* This is intended for internal use by the Simple JDBC classes.
*
* @author Thomas Risberg
* @since 2.5
@@ -32,45 +32,37 @@ import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor;
public interface TableMetaDataProvider {
/**
* Initialize using the database metedata provided
* @param databaseMetaData
* @throws SQLException
* Initialize using the database metadata provided.
* @param databaseMetaData used to retrieve database specific information
* @throws SQLException in case of initialization failure
*/
void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException;
/**
* Initialize using provided database metadata, table and column information. This initalization can be
* turned off by specifying that column meta data should not be used.
* Initialize using provided database metadata, table and column information.
* 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 catalogName name of catalog to use or null
* @param schemaName name of schema name to use or null
* @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 tableName name of the table
* @throws SQLException
* @throws SQLException in case of initialization failure
*/
void initializeWithTableColumnMetaData(DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String tableName)
void initializeWithTableColumnMetaData(
DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String tableName)
throws SQLException;
/**
* Get the table name formatted based on metadata information. This could include altering the case.
*
* @param tableName
* @return table name formatted
*/
String tableNameToUse(String tableName);
/**
* Get the catalog name formatted based on metadata information. This could include altering the case.
*
* @param catalogName
* @return catalog name formatted
*/
String catalogNameToUse(String catalogName);
/**
* Get the schema name formatted based on metadata information. This could include altering the case.
*
* @param schemaName
* @return schema name formatted
*/
String schemaNameToUse(String schemaName);
@@ -78,9 +70,6 @@ public interface TableMetaDataProvider {
* 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
* providing a base catalog if none is provided.
*
* @param catalogName
* @return catalog name to use
*/
String metaDataCatalogNameToUse(String catalogName) ;
@@ -88,9 +77,6 @@ public interface TableMetaDataProvider {
* 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
* providing a base schema if none is provided.
*
* @param schemaName
* @return schema name to use
*/
String metaDataSchemaNameToUse(String schemaName) ;
@@ -100,15 +86,15 @@ public interface TableMetaDataProvider {
boolean isTableColumnMetaDataUsed();
/**
* Does this database support the JDBC 3.0 feature of retreiving generated keys
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}
* Does this database support the JDBC 3.0 feature of retrieving generated keys
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}?
*/
boolean isGetGeneratedKeysSupported();
/**
* Does this database support a simple quey to retrieve the generated key whe the JDBC 3.0 feature
* of retreiving generated keys is not supported
* {@link java.sql.DatabaseMetaData#supportsGetGeneratedKeys()}
* Does this database support a simple query to retrieve the generated key when
* the JDBC 3.0 feature of retrieving generated keys is not supported?
* @see #isGetGeneratedKeysSupported()
*/
boolean isGetGeneratedKeysSimulated();
@@ -118,7 +104,7 @@ public interface TableMetaDataProvider {
String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName);
/**
* Does this database support a column name String array for retreiving generated keys
* Does this database support a column name String array for retrieving generated keys
* {@link java.sql.Connection#createStruct(String, Object[])}
*/
boolean isGeneratedKeysColumnNameArraySupported();
@@ -133,4 +119,5 @@ public interface TableMetaDataProvider {
* Set the {@link NativeJdbcExtractor} to use to retrieve the native connection if necessary
*/
void setNativeJdbcExtractor(NativeJdbcExtractor nativeJdbcExtractor);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@@ -42,9 +42,9 @@ public class TableMetaDataProviderFactory {
/**
* Create a TableMetaDataProvider based on the database metedata
* @param dataSource used to retrieve metedata
* @param context the class that holds configuration and metedata
* Create a TableMetaDataProvider based on the database metadata.
* @param dataSource used to retrieve metadata
* @param context the class that holds configuration and metadata
* @return instance of the TableMetaDataProvider implementation to be used
*/
public static TableMetaDataProvider createMetaDataProvider(DataSource dataSource, TableMetaDataContext context) {
@@ -52,9 +52,9 @@ public class TableMetaDataProviderFactory {
}
/**
* Create a TableMetaDataProvider based on the database metedata
* @param dataSource used to retrieve metedata
* @param context the class that holds configuration and metedata
* Create a TableMetaDataProvider based on the database metadata.
* @param dataSource used to retrieve metadata
* @param context the class that holds configuration and metadata
* @param nativeJdbcExtractor the NativeJdbcExtractor to be used
* @return instance of the TableMetaDataProvider implementation to be used
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -75,9 +75,8 @@ public interface SimpleJdbcInsertOperations {
/**
* Include synonyms for the column meta data lookups via JDBC.
* Note: this is only necessary to include for Oracle since other
* databases supporting synonyms seems to include the synonyms
* automatically.
* <p>Note: This is only necessary to include for Oracle since other databases
* supporting synonyms seems to include the synonyms automatically.
* @return the instance of this SimpleJdbcInsert
*/
SimpleJdbcInsertOperations includeSynonymsForTableColumnMetaData();
@@ -85,7 +84,7 @@ public interface SimpleJdbcInsertOperations {
/**
* Use a the provided NativeJdbcExtractor during the column meta data
* lookups via JDBC.
* Note: this is only necessary to include when running with a connection pool
* <p>Note: This is only necessary to include when running with a connection pool
* that wraps the meta data connection and when using a database like Oracle
* where it is necessary to access the native connection to include synonyms.
* @return the instance of this SimpleJdbcInsert

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -85,7 +85,7 @@ public class JdbcBeanDefinitionReader {
/**
* Set the JdbcTemplate to be used by this bean factory.
* Contains settings for DataSource, SQLExceptionTranslator, NativeJdbcExtractor, etc.
* Contains settings for DataSource, SQLExceptionTranslator, etc.
*/
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
Assert.notNull(jdbcTemplate, "JdbcTemplate must not be null");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2017 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.
@@ -26,7 +26,8 @@ import java.sql.Connection;
* native JDBC Connection such as Oracle's OracleConnection. Spring's
* {@link org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter}
* automatically detects such proxies before delegating to the actual
* unwrapping for a specific connection pool.
* unwrapping for a specific connection pool. Alternatively, all such
* connections also support JDBC 4.0's {@link Connection#unwrap}.
*
* @author Juergen Hoeller
* @since 1.1

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 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.
@@ -54,7 +54,7 @@ import org.springframework.core.Constants;
* without paying a performance penalty if no actual data access happens.
*
* <p>This DataSource proxy gives you behavior analogous to JTA and a
* transactional JNDI DataSource (as provided by the J2EE server), even
* transactional JNDI DataSource (as provided by the Java EE server), even
* with a local transaction strategy like DataSourceTransactionManager or
* HibernateTransactionManager. It does not add value with Spring's
* JtaTransactionManager as transaction strategy.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 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.
@@ -39,9 +39,6 @@ import org.springframework.util.ObjectUtils;
* <p>If client code will call {@code close()} in the assumption of a pooled
* Connection, like when using persistence tools, set "suppressClose" to "true".
* This will return a close-suppressing proxy instead of the physical Connection.
* Be aware that you will not be able to cast this to a native
* {@code OracleConnection} or the like anymore; you need to use a
* {@link org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor} then.
*
* <p>This is primarily intended for testing. For example, it enables easy testing
* outside an application server, for code that expects to work on a DataSource.
@@ -53,10 +50,8 @@ import org.springframework.util.ObjectUtils;
* @see #getConnection()
* @see java.sql.Connection#close()
* @see DataSourceUtils#releaseConnection
* @see org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor
*/
public class SingleConnectionDataSource extends DriverManagerDataSource
implements SmartDataSource, DisposableBean {
public class SingleConnectionDataSource extends DriverManagerDataSource implements SmartDataSource, DisposableBean {
/** Create a close-suppressing proxy? */
private boolean suppressClose;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 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.
@@ -31,7 +31,7 @@ import org.springframework.util.Assert;
/**
* Proxy for a target JDBC {@link javax.sql.DataSource}, adding awareness of
* Spring-managed transactions. Similar to a transactional JNDI DataSource
* as provided by a J2EE server.
* as provided by a Java EE server.
*
* <p>Data access code that should remain unaware of Spring's data access support
* can work with this proxy to seamlessly participate in Spring-managed transactions.
@@ -51,7 +51,7 @@ import org.springframework.util.Assert;
* Connection. If not within a transaction, normal DataSource behavior applies.
*
* <p>This proxy allows data access code to work with the plain JDBC API and still
* participate in Spring-managed transactions, similar to JDBC code in a J2EE/JTA
* participate in Spring-managed transactions, similar to JDBC code in a Java EE/JTA
* environment. However, if possible, use Spring's DataSourceUtils, JdbcTemplate or
* JDBC operation objects to get transaction participation even without a proxy for
* the target DataSource, avoiding the need to define such a proxy in the first place.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2017 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.
@@ -95,12 +95,12 @@ public class WebSphereDataSourceAdapter extends IsolationLevelDataSourceAdapter
Class<?> wsrraFactoryClass = getClass().getClassLoader().loadClass("com.ibm.websphere.rsadapter.WSRRAFactory");
this.newJdbcConnSpecMethod = wsrraFactoryClass.getMethod("createJDBCConnectionSpec", (Class<?>[]) null);
this.wsDataSourceGetConnectionMethod =
this.wsDataSourceClass.getMethod("getConnection", new Class<?>[] {jdbcConnSpecClass});
this.wsDataSourceClass.getMethod("getConnection", jdbcConnSpecClass);
this.setTransactionIsolationMethod =
jdbcConnSpecClass.getMethod("setTransactionIsolation", new Class<?>[] {int.class});
this.setReadOnlyMethod = jdbcConnSpecClass.getMethod("setReadOnly", new Class<?>[] {Boolean.class});
this.setUserNameMethod = jdbcConnSpecClass.getMethod("setUserName", new Class<?>[] {String.class});
this.setPasswordMethod = jdbcConnSpecClass.getMethod("setPassword", new Class<?>[] {String.class});
jdbcConnSpecClass.getMethod("setTransactionIsolation", int.class);
this.setReadOnlyMethod = jdbcConnSpecClass.getMethod("setReadOnly", Boolean.class);
this.setUserNameMethod = jdbcConnSpecClass.getMethod("setUserName", String.class);
this.setPasswordMethod = jdbcConnSpecClass.getMethod("setPassword", String.class);
}
catch (Exception ex) {
throw new IllegalStateException(
@@ -144,7 +144,7 @@ public class WebSphereDataSourceAdapter extends IsolationLevelDataSourceAdapter
}
/**
* Create a WebSphere {@code JDBCConnectionSpec} object for the given charateristics.
* Create a WebSphere {@code JDBCConnectionSpec} object for the given characteristics.
* <p>The default implementation uses reflection to apply the given settings.
* Can be overridden in subclasses to customize the JDBCConnectionSpec object
* (<a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/rsadapter/JDBCConnectionSpec.html">JDBCConnectionSpec javadoc</a>;

View File

@@ -422,7 +422,7 @@ public abstract class JdbcUtils {
/**
* Extract a common name for the database in use even if various drivers/platforms provide varying names.
* @param source the name as provided in database metedata
* @param source the name as provided in database metadata
* @return the common name to be used
*/
public static String commonDatabaseName(String source) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@@ -143,10 +143,9 @@ public class JdbcTemplateTests {
@Test
public void testStringsWithStaticSql() throws Exception {
doTestStrings(false, null, null, null, null, new JdbcTemplateCallback() {
doTestStrings(null, null, null, null, new JdbcTemplateCallback() {
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql,
RowCallbackHandler rch) {
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, rch);
}
});
@@ -154,10 +153,9 @@ public class JdbcTemplateTests {
@Test
public void testStringsWithStaticSqlAndFetchSizeAndMaxRows() throws Exception {
doTestStrings(false, 10, 20, 30, null, new JdbcTemplateCallback() {
doTestStrings(10, 20, 30, null, new JdbcTemplateCallback() {
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql,
RowCallbackHandler rch) {
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, rch);
}
});
@@ -165,10 +163,9 @@ public class JdbcTemplateTests {
@Test
public void testStringsWithEmptyPreparedStatementSetter() throws Exception {
doTestStrings(true, null, null, null, null, new JdbcTemplateCallback() {
doTestStrings(null, null, null, null, new JdbcTemplateCallback() {
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql,
RowCallbackHandler rch) {
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, (PreparedStatementSetter) null, rch);
}
});
@@ -177,10 +174,9 @@ public class JdbcTemplateTests {
@Test
public void testStringsWithPreparedStatementSetter() throws Exception {
final Integer argument = 99;
doTestStrings(true, null, null, null, argument, new JdbcTemplateCallback() {
doTestStrings(null, null, null, argument, new JdbcTemplateCallback() {
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql,
RowCallbackHandler rch) {
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, new PreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps) throws SQLException {
@@ -193,10 +189,9 @@ public class JdbcTemplateTests {
@Test
public void testStringsWithEmptyPreparedStatementArgs() throws Exception {
doTestStrings(true, null, null, null, null, new JdbcTemplateCallback() {
doTestStrings(null, null, null, null, new JdbcTemplateCallback() {
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql,
RowCallbackHandler rch) {
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, (Object[]) null, rch);
}
});
@@ -205,26 +200,22 @@ public class JdbcTemplateTests {
@Test
public void testStringsWithPreparedStatementArgs() throws Exception {
final Integer argument = 99;
doTestStrings(true, null, null, null, argument, new JdbcTemplateCallback() {
doTestStrings(null, null, null, argument, new JdbcTemplateCallback() {
@Override
public void doInJdbcTemplate(JdbcTemplate template, String sql,
RowCallbackHandler rch) {
public void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch) {
template.query(sql, new Object[] { argument }, rch);
}
});
}
private void doTestStrings(
boolean usePreparedStatement,
Integer fetchSize, Integer maxRows, Integer queryTimeout, Object argument,
JdbcTemplateCallback jdbcTemplateCallback)
throws Exception {
private void doTestStrings(Integer fetchSize, Integer maxRows, Integer queryTimeout,
Object argument, JdbcTemplateCallback jdbcTemplateCallback) throws Exception {
String sql = "SELECT FORENAME FROM CUSTMR";
String[] results = { "rod", "gary", " portia" };
class StringHandler implements RowCallbackHandler {
private List<String> list = new LinkedList<String>();
private List<String> list = new LinkedList<>();
@Override
public void processRow(ResultSet rs) throws SQLException {
this.list.add(rs.getString(1));
@@ -740,9 +731,8 @@ public class JdbcTemplateTests {
@Test
public void testBatchUpdateWithListOfObjectArrays() throws Exception {
final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
final List<Object[]> ids = new ArrayList<Object[]>();
final List<Object[]> ids = new ArrayList<>();
ids.add(new Object[] {100});
ids.add(new Object[] {200});
final int[] rowsAffected = new int[] { 1, 2 };
@@ -768,7 +758,7 @@ public class JdbcTemplateTests {
@Test
public void testBatchUpdateWithListOfObjectArraysPlusTypeInfo() throws Exception {
final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
final List<Object[]> ids = new ArrayList<Object[]>();
final List<Object[]> ids = new ArrayList<>();
ids.add(new Object[] {100});
ids.add(new Object[] {200});
final int[] sqlTypes = new int[] {Types.NUMERIC};
@@ -851,13 +841,15 @@ public class JdbcTemplateTests {
@Test
public void testCouldntGetConnectionInOperationWithExceptionTranslatorInitializedViaBeanProperty()
throws Exception {
throws SQLException {
doTestCouldntGetConnectionInOperationWithExceptionTranslatorInitialized(true);
}
@Test
public void testCouldntGetConnectionInOperationWithExceptionTranslatorInitializedInAfterPropertiesSet()
throws Exception {
throws SQLException {
doTestCouldntGetConnectionInOperationWithExceptionTranslatorInitialized(false);
}
@@ -867,6 +859,7 @@ public class JdbcTemplateTests {
*/
private void doTestCouldntGetConnectionInOperationWithExceptionTranslatorInitialized(boolean beanProperty)
throws SQLException {
SQLException sqlException = new SQLException("foo", "07xxx");
this.dataSource = mock(DataSource.class);
given(this.dataSource.getConnection()).willThrow(sqlException);
@@ -1098,7 +1091,6 @@ public class JdbcTemplateTests {
@Test
public void testNativeJdbcExtractorInvoked() throws Exception {
final Statement statement2 = mock(Statement.class);
given(statement2.executeQuery(anyString())).willReturn(this.resultSet);
@@ -1246,7 +1238,7 @@ public class JdbcTemplateTests {
given(this.callableStatement.execute()).willReturn(true);
given(this.callableStatement.getUpdateCount()).willReturn(-1);
List<SqlParameter> params = new ArrayList<SqlParameter>();
List<SqlParameter> params = new ArrayList<>();
params.add(new SqlReturnResultSet("", new RowCallbackHandler() {
@Override
public void processRow(ResultSet rs) {
@@ -1286,7 +1278,7 @@ public class JdbcTemplateTests {
assertTrue("now it should have been set to case insensitive",
this.template.isResultsMapCaseInsensitive());
List<SqlParameter> params = new ArrayList<SqlParameter>();
List<SqlParameter> params = new ArrayList<>();
params.add(new SqlOutParameter("a", 12));
Map<String, Object> out = this.template.call(new CallableStatementCreator() {
@@ -1311,6 +1303,7 @@ public class JdbcTemplateTests {
given(this.connection.getMetaData()).willReturn(databaseMetaData);
}
private static class PlainNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
@Override
@@ -1320,7 +1313,7 @@ public class JdbcTemplateTests {
}
private static interface JdbcTemplateCallback {
private interface JdbcTemplateCallback {
void doInJdbcTemplate(JdbcTemplate template, String sql, RowCallbackHandler rch);
}
@@ -1329,6 +1322,7 @@ public class JdbcTemplateTests {
private static class Dispatcher implements PreparedStatementCreator, SqlProvider {
private int id;
private String sql;
public Dispatcher(int id, String sql) {
@@ -1348,4 +1342,5 @@ public class JdbcTemplateTests {
return this.sql;
}
}
}