Added @Override and @Deprecated annotations to jdbc module
This commit is contained in:
parent
aa60746155
commit
cdb36efb0d
|
@ -43,6 +43,7 @@ public class CannotGetJdbcConnectionException extends DataAccessResourceFailureE
|
|||
* @deprecated since Spring 2.5, in favor of throwing an
|
||||
* IllegalStateException in case of the driver not being found
|
||||
*/
|
||||
@Deprecated
|
||||
public CannotGetJdbcConnectionException(String msg, ClassNotFoundException ex) {
|
||||
super(msg, ex);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public class JdbcUpdateAffectedIncorrectNumberOfRowsException extends IncorrectU
|
|||
return this.actual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasDataUpdated() {
|
||||
return (getActualRowsAffected() > 0);
|
||||
}
|
||||
|
|
|
@ -229,6 +229,7 @@ public class CallableStatementCreatorFactory {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer("CallableStatementCreatorFactory.CallableStatementCreatorImpl: sql=[");
|
||||
buf.append(callString).append("]; parameters=").append(this.inParameters);
|
||||
|
|
|
@ -311,6 +311,7 @@ public class PreparedStatementCreatorFactory {
|
|||
StatementCreatorUtils.cleanupParameters(this.parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer("PreparedStatementCreatorFactory.PreparedStatementCreatorImpl: sql=[");
|
||||
buf.append(sql).append("]; parameters=").append(this.parameters);
|
||||
|
|
|
@ -129,6 +129,7 @@ public class ResultSetSupportingSqlParameter extends SqlParameter {
|
|||
/**
|
||||
* <p>This implementation always returns <code>false</code>.
|
||||
*/
|
||||
@Override
|
||||
public boolean isInputValueProvided() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ public class SqlInOutParameter extends SqlOutParameter {
|
|||
/**
|
||||
* This implementation always returns <code>true</code>.
|
||||
*/
|
||||
@Override
|
||||
public boolean isInputValueProvided() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public class SqlReturnResultSet extends ResultSetSupportingSqlParameter {
|
|||
* results preocessing of the CallableStatement.getMoreResults/getUpdateCount.
|
||||
* <p>This implementation always returns <code>true</code>.
|
||||
*/
|
||||
@Override
|
||||
public boolean isResultsParameter() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ public class SqlReturnUpdateCount extends SqlParameter {
|
|||
* before execution even if they are <code>null</code>.
|
||||
* <p>This implementation always returns <code>false</code>.
|
||||
*/
|
||||
@Override
|
||||
public boolean isInputValueProvided() {
|
||||
return false;
|
||||
}
|
||||
|
@ -35,6 +36,7 @@ public class SqlReturnUpdateCount extends SqlParameter {
|
|||
* results preocessing of the CallableStatement.getMoreResults/getUpdateCount.
|
||||
* <p>This implementation always returns <code>true</code>.
|
||||
*/
|
||||
@Override
|
||||
public boolean isResultsParameter() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -33,11 +33,13 @@ public class HsqlTableMetaDataProvider extends GenericTableMetaDataProvider {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isGetGeneratedKeysSimulated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName) {
|
||||
return "select max(identity()) from " + tableName;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ public class PostgresTableMetaDataProvider extends GenericTableMetaDataProvider
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isGetGeneratedKeysSimulated() {
|
||||
if (getDatabaseVersion().compareTo("8.2.0") >= 0) {
|
||||
return true;
|
||||
|
@ -28,6 +29,7 @@ public class PostgresTableMetaDataProvider extends GenericTableMetaDataProvider
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getSimpleQueryForGetGeneratedKey(String tableName, String keyColumnName) {
|
||||
return "RETURNING " + keyColumnName;
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ public class BeanPropertySqlParameterSource extends AbstractSqlParameterSource {
|
|||
* Derives a default SQL type from the corresponding property type.
|
||||
* @see org.springframework.jdbc.core.StatementCreatorUtils#javaTypeToSqlParameterType
|
||||
*/
|
||||
@Override
|
||||
public int getSqlType(String paramName) {
|
||||
int sqlType = super.getSqlType(paramName);
|
||||
if (sqlType != TYPE_UNKNOWN) {
|
||||
|
|
|
@ -34,6 +34,7 @@ public class NamedParameterJdbcDaoSupport extends JdbcDaoSupport {
|
|||
/**
|
||||
* Create a NamedParameterJdbcTemplate based on the configured JdbcTemplate.
|
||||
*/
|
||||
@Override
|
||||
protected void initTemplateConfig() {
|
||||
this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(getJdbcTemplate());
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ public class ParsedSql {
|
|||
/**
|
||||
* Exposes the original SQL String.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.originalSql;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ public class ParameterizedBeanPropertyRowMapper<T> extends BeanPropertyRowMapper
|
|||
public ParameterizedBeanPropertyRowMapper() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T mapRow(ResultSet rs, int rowNumber) throws SQLException {
|
||||
return (T) super.mapRow(rs, rowNumber);
|
||||
|
|
|
@ -48,6 +48,7 @@ public class ParameterizedSingleColumnRowMapper<T> extends SingleColumnRowMapper
|
|||
public ParameterizedSingleColumnRowMapper() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T mapRow(ResultSet rs, int rowNumber) throws SQLException {
|
||||
return (T) super.mapRow(rs, rowNumber);
|
||||
|
|
|
@ -36,6 +36,7 @@ public class SimpleJdbcDaoSupport extends JdbcDaoSupport {
|
|||
/**
|
||||
* Create a SimpleJdbcTemplate based on the configured JdbcTemplate.
|
||||
*/
|
||||
@Override
|
||||
protected void initTemplateConfig() {
|
||||
this.simpleJdbcTemplate = new SimpleJdbcTemplate(getJdbcTemplate());
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ public abstract class JdbcDaoSupport extends DaoSupport {
|
|||
protected void initTemplateConfig() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkDaoConfig() {
|
||||
if (this.jdbcTemplate == null) {
|
||||
throw new IllegalArgumentException("'dataSource' or 'jdbcTemplate' is required");
|
||||
|
|
|
@ -186,6 +186,7 @@ public class ConnectionHolder extends ResourceHolderSupport {
|
|||
* JDO 2.0 DataStoreConnections, for example.
|
||||
* @see org.springframework.orm.jdo.DefaultJdoDialect#getJdbcConnection
|
||||
*/
|
||||
@Override
|
||||
public void released() {
|
||||
super.released();
|
||||
if (this.currentConnection != null) {
|
||||
|
@ -195,6 +196,7 @@ public class ConnectionHolder extends ResourceHolderSupport {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
this.transactionActive = false;
|
||||
|
|
|
@ -173,6 +173,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||
return getDataSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doGetTransaction() {
|
||||
DataSourceTransactionObject txObject = new DataSourceTransactionObject();
|
||||
txObject.setSavepointAllowed(isNestedTransactionAllowed());
|
||||
|
@ -182,6 +183,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||
return txObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isExistingTransaction(Object transaction) {
|
||||
DataSourceTransactionObject txObject = (DataSourceTransactionObject) transaction;
|
||||
return (txObject.getConnectionHolder() != null && txObject.getConnectionHolder().isTransactionActive());
|
||||
|
@ -190,6 +192,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||
/**
|
||||
* This implementation sets the isolation level but ignores the timeout.
|
||||
*/
|
||||
@Override
|
||||
protected void doBegin(Object transaction, TransactionDefinition definition) {
|
||||
DataSourceTransactionObject txObject = (DataSourceTransactionObject) transaction;
|
||||
Connection con = null;
|
||||
|
@ -239,6 +242,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doSuspend(Object transaction) {
|
||||
DataSourceTransactionObject txObject = (DataSourceTransactionObject) transaction;
|
||||
txObject.setConnectionHolder(null);
|
||||
|
@ -247,11 +251,13 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||
return conHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doResume(Object transaction, Object suspendedResources) {
|
||||
ConnectionHolder conHolder = (ConnectionHolder) suspendedResources;
|
||||
TransactionSynchronizationManager.bindResource(this.dataSource, conHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCommit(DefaultTransactionStatus status) {
|
||||
DataSourceTransactionObject txObject = (DataSourceTransactionObject) status.getTransaction();
|
||||
Connection con = txObject.getConnectionHolder().getConnection();
|
||||
|
@ -266,6 +272,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRollback(DefaultTransactionStatus status) {
|
||||
DataSourceTransactionObject txObject = (DataSourceTransactionObject) status.getTransaction();
|
||||
Connection con = txObject.getConnectionHolder().getConnection();
|
||||
|
@ -280,6 +287,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
|
||||
DataSourceTransactionObject txObject = (DataSourceTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
|
@ -289,6 +297,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||
txObject.setRollbackOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCleanupAfterCompletion(Object transaction) {
|
||||
DataSourceTransactionObject txObject = (DataSourceTransactionObject) transaction;
|
||||
|
||||
|
|
|
@ -391,10 +391,12 @@ public abstract class DataSourceUtils {
|
|||
this.order = getConnectionSynchronizationOrder(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspend() {
|
||||
if (this.holderActive) {
|
||||
TransactionSynchronizationManager.unbindResource(this.dataSource);
|
||||
|
@ -409,12 +411,14 @@ public abstract class DataSourceUtils {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
if (this.holderActive) {
|
||||
TransactionSynchronizationManager.bindResource(this.dataSource, this.connectionHolder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCompletion() {
|
||||
// Release Connection early if the holder is not open anymore
|
||||
// (that is, not used by another resource like a Hibernate Session
|
||||
|
@ -430,6 +434,7 @@ public abstract class DataSourceUtils {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
// If we haven't closed the Connection in beforeCompletion,
|
||||
// close it now. The holder might have been used for other
|
||||
|
|
|
@ -119,6 +119,7 @@ public class DriverManagerDataSource extends AbstractDriverBasedDataSource {
|
|||
* If you need to register a new driver, consider using
|
||||
* {@link SimpleDriverDataSource} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public DriverManagerDataSource(String driverClassName, String url, String username, String password) {
|
||||
setDriverClassName(driverClassName);
|
||||
setUrl(url);
|
||||
|
@ -157,6 +158,7 @@ public class DriverManagerDataSource extends AbstractDriverBasedDataSource {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Connection getConnectionFromDriver(Properties props) throws SQLException {
|
||||
String url = getUrl();
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
|
|
@ -123,6 +123,7 @@ public class IsolationLevelDataSourceAdapter extends UserCredentialsDataSourceAd
|
|||
* @see #getCurrentIsolationLevel()
|
||||
* @see #getCurrentReadOnlyFlag()
|
||||
*/
|
||||
@Override
|
||||
protected Connection doGetConnection(String username, String password) throws SQLException {
|
||||
Connection con = super.doGetConnection(username, password);
|
||||
Boolean readOnlyToUse = getCurrentReadOnlyFlag();
|
||||
|
|
|
@ -153,6 +153,7 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
super.afterPropertiesSet();
|
||||
|
||||
|
@ -216,6 +217,7 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource {
|
|||
* @return a lazy Connection handle
|
||||
* @see ConnectionProxy#getTargetConnection()
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
return (Connection) Proxy.newProxyInstance(
|
||||
ConnectionProxy.class.getClassLoader(),
|
||||
|
@ -233,6 +235,7 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource {
|
|||
* @return a lazy Connection handle
|
||||
* @see ConnectionProxy#getTargetConnection()
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection(String username, String password) throws SQLException {
|
||||
return (Connection) Proxy.newProxyInstance(
|
||||
ConnectionProxy.class.getClassLoader(),
|
||||
|
|
|
@ -56,6 +56,7 @@ public class SimpleConnectionHandle implements ConnectionHandle {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SimpleConnectionHandle: " + this.connection;
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ public class SimpleDriverDataSource extends AbstractDriverBasedDataSource {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Connection getConnectionFromDriver(Properties props) throws SQLException {
|
||||
Driver driver = getDriver();
|
||||
String url = getUrl();
|
||||
|
|
|
@ -94,6 +94,7 @@ public class SingleConnectionDataSource extends DriverManagerDataSource
|
|||
* directly, set up the Driver class manually before invoking this DataSource.
|
||||
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||
*/
|
||||
@Deprecated
|
||||
public SingleConnectionDataSource(
|
||||
String driverClassName, String url, String username, String password, boolean suppressClose) {
|
||||
|
||||
|
@ -177,6 +178,7 @@ public class SingleConnectionDataSource extends DriverManagerDataSource
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
synchronized (this.connectionMonitor) {
|
||||
if (this.connection == null) {
|
||||
|
@ -197,6 +199,7 @@ public class SingleConnectionDataSource extends DriverManagerDataSource
|
|||
* with a single Connection. Returns the single Connection if given
|
||||
* the same username and password; throws a SQLException else.
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection(String username, String password) throws SQLException {
|
||||
if (ObjectUtils.nullSafeEquals(username, getUsername()) &&
|
||||
ObjectUtils.nullSafeEquals(password, getPassword())) {
|
||||
|
|
|
@ -121,6 +121,7 @@ public class TransactionAwareDataSourceProxy extends DelegatingDataSource {
|
|||
* @see DataSourceUtils#doGetConnection
|
||||
* @see ConnectionProxy#getTargetConnection
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
DataSource ds = getTargetDataSource();
|
||||
Assert.state(ds != null, "'targetDataSource' is required");
|
||||
|
|
|
@ -124,6 +124,7 @@ public class UserCredentialsDataSourceAdapter extends DelegatingDataSource {
|
|||
* <p>Delegates to {@link #doGetConnection(String, String)} with the
|
||||
* determined credentials as parameters.
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
JdbcUserCredentials threadCredentials = (JdbcUserCredentials) this.threadBoundCredentials.get();
|
||||
if (threadCredentials != null) {
|
||||
|
@ -138,6 +139,7 @@ public class UserCredentialsDataSourceAdapter extends DelegatingDataSource {
|
|||
* Simply delegates to {@link #doGetConnection(String, String)},
|
||||
* keeping the given user credentials as-is.
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection(String username, String password) throws SQLException {
|
||||
return doGetConnection(username, password);
|
||||
}
|
||||
|
@ -178,6 +180,7 @@ public class UserCredentialsDataSourceAdapter extends DelegatingDataSource {
|
|||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JdbcUserCredentials[username='" + this.username + "',password='" + this.password + "']";
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ public class WebSphereDataSourceAdapter extends IsolationLevelDataSourceAdapter
|
|||
* Checks that the specified 'targetDataSource' actually is
|
||||
* a WebSphere WSDataSource.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
super.afterPropertiesSet();
|
||||
|
||||
|
@ -129,6 +130,7 @@ public class WebSphereDataSourceAdapter extends IsolationLevelDataSourceAdapter
|
|||
* @see #createConnectionSpec
|
||||
* @see com.ibm.websphere.rsadapter.WSDataSource#getConnection(com.ibm.websphere.rsadapter.JDBCConnectionSpec)
|
||||
*/
|
||||
@Override
|
||||
protected Connection doGetConnection(String username, String password) throws SQLException {
|
||||
// Create JDBCConnectionSpec using current isolation level value and read-only flag.
|
||||
Object connSpec = createConnectionSpec(
|
||||
|
|
|
@ -100,6 +100,7 @@ public class IsolationLevelDataSourceRouter extends AbstractRoutingDataSource {
|
|||
* as well as isolation level names as defined on the
|
||||
* {@link org.springframework.transaction.TransactionDefinition TransactionDefinition interface}.
|
||||
*/
|
||||
@Override
|
||||
protected Object resolveSpecifiedLookupKey(Object lookupKey) {
|
||||
if (lookupKey instanceof Integer) {
|
||||
return (Integer) lookupKey;
|
||||
|
@ -117,6 +118,7 @@ public class IsolationLevelDataSourceRouter extends AbstractRoutingDataSource {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object determineCurrentLookupKey() {
|
||||
return TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@ public class BatchSqlUpdate extends SqlUpdate {
|
|||
/**
|
||||
* BatchSqlUpdate does not support BLOB or CLOB parameters.
|
||||
*/
|
||||
@Override
|
||||
protected boolean supportsLobParameters() {
|
||||
return false;
|
||||
}
|
||||
|
@ -157,6 +158,7 @@ public class BatchSqlUpdate extends SqlUpdate {
|
|||
* executed by this method)
|
||||
* @see #flush
|
||||
*/
|
||||
@Override
|
||||
public int update(Object[] params) throws DataAccessException {
|
||||
validateParameters(params);
|
||||
this.parameterQueue.add(params.clone());
|
||||
|
|
|
@ -58,6 +58,7 @@ public abstract class MappingSqlQuery extends MappingSqlQueryWithParameters {
|
|||
* template method, ignoring parameters.
|
||||
* @see #mapRow(ResultSet, int)
|
||||
*/
|
||||
@Override
|
||||
protected final Object mapRow(ResultSet rs, int rowNum, Object[] parameters, Map context)
|
||||
throws SQLException {
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ public abstract class MappingSqlQueryWithParameters extends SqlQuery {
|
|||
* Implementation of protected abstract method. This invokes the subclass's
|
||||
* implementation of the mapRow() method.
|
||||
*/
|
||||
@Override
|
||||
protected RowMapper newRowMapper(Object[] parameters, Map context) {
|
||||
return new RowMapperImpl(parameters, context);
|
||||
}
|
||||
|
|
|
@ -124,6 +124,7 @@ public abstract class SqlCall extends RdbmsOperation {
|
|||
* based on our declared parameters.
|
||||
* @see RdbmsOperation#compileInternal()
|
||||
*/
|
||||
@Override
|
||||
protected final void compileInternal() {
|
||||
if (isSqlReadyForUse()) {
|
||||
this.callString = getSql();
|
||||
|
|
|
@ -128,6 +128,7 @@ public class SqlFunction extends MappingSqlQuery {
|
|||
* single row returned by the function. If there are a different number
|
||||
* of rows returned, this is treated as an error.
|
||||
*/
|
||||
@Override
|
||||
protected Object mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
return this.rowMapper.mapRow(rs, rowNum);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public abstract class SqlOperation extends RdbmsOperation {
|
|||
* Overridden method to configure the PreparedStatementCreatorFactory
|
||||
* based on our declared parameters.
|
||||
*/
|
||||
@Override
|
||||
protected final void compileInternal() {
|
||||
this.preparedStatementFactory = new PreparedStatementCreatorFactory(getSql(), getDeclaredParameters());
|
||||
this.preparedStatementFactory.setResultSetType(getResultSetType());
|
||||
|
|
|
@ -75,6 +75,7 @@ public abstract class StoredProcedure extends SqlCall {
|
|||
* StoredProcedure parameter Maps are by default allowed to contain
|
||||
* additional entries that are not actually used as parameters.
|
||||
*/
|
||||
@Override
|
||||
protected boolean allowsUnusedParameters() {
|
||||
return true;
|
||||
}
|
||||
|
@ -90,6 +91,7 @@ public abstract class StoredProcedure extends SqlCall {
|
|||
* Names are purely used to help mapping.
|
||||
* @param param parameter object
|
||||
*/
|
||||
@Override
|
||||
public void declareParameter(SqlParameter param) throws InvalidDataAccessApiUsageException {
|
||||
if (param.getName() == null) {
|
||||
throw new InvalidDataAccessApiUsageException("Parameters to stored procedures must have names as well as types");
|
||||
|
|
|
@ -58,6 +58,7 @@ public abstract class UpdatableSqlQuery extends SqlQuery {
|
|||
* Implementation of the superclass template method. This invokes the subclass's
|
||||
* implementation of the <code>updateRow()</code> method.
|
||||
*/
|
||||
@Override
|
||||
protected RowMapper newRowMapper(Object[] parameters, Map context) {
|
||||
return new RowMapperImpl(context);
|
||||
}
|
||||
|
|
|
@ -170,6 +170,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected DataAccessException doTranslate(String task, String sql, SQLException ex) {
|
||||
SQLException sqlEx = ex;
|
||||
if (sqlEx instanceof BatchUpdateException && sqlEx.getNextException() != null) {
|
||||
|
|
|
@ -61,6 +61,7 @@ public class SQLExceptionSubclassTranslator extends AbstractFallbackSQLException
|
|||
setFallbackTranslator(new SQLStateSQLExceptionTranslator());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataAccessException doTranslate(String task, String sql, SQLException ex) {
|
||||
if (ex instanceof SQLTransientException) {
|
||||
if (ex instanceof SQLTransactionRollbackException) {
|
||||
|
|
|
@ -86,6 +86,7 @@ public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLException
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected DataAccessException doTranslate(String task, String sql, SQLException ex) {
|
||||
String sqlState = getSqlState(ex);
|
||||
if (sqlState != null && sqlState.length() >= 2) {
|
||||
|
|
|
@ -87,6 +87,7 @@ public abstract class AbstractColumnMaxValueIncrementer extends AbstractDataFiel
|
|||
return this.cacheSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
super.afterPropertiesSet();
|
||||
if (this.columnName == null) {
|
||||
|
|
|
@ -59,6 +59,7 @@ public abstract class AbstractSequenceMaxValueIncrementer extends AbstractDataFi
|
|||
/**
|
||||
* Executes the SQL as specified by {@link #getSequenceQuery()}.
|
||||
*/
|
||||
@Override
|
||||
protected long getNextKey() throws DataAccessException {
|
||||
Connection con = DataSourceUtils.getConnection(getDataSource());
|
||||
Statement stmt = null;
|
||||
|
|
|
@ -46,6 +46,7 @@ public class DB2MainframeSequenceMaxValueIncrementer extends AbstractSequenceMax
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getSequenceQuery() {
|
||||
return "select next value for " + getIncrementerName() + " from sysibm.sysdummy1";
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public class DB2SequenceMaxValueIncrementer extends AbstractSequenceMaxValueIncr
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getSequenceQuery() {
|
||||
return "values nextval for " + getIncrementerName();
|
||||
}
|
||||
|
|
|
@ -126,6 +126,7 @@ public class DerbyMaxValueIncrementer extends AbstractColumnMaxValueIncrementer
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected synchronized long getNextKey() throws DataAccessException {
|
||||
if (this.nextValueIndex < 0 || this.nextValueIndex >= getCacheSize()) {
|
||||
/*
|
||||
|
|
|
@ -44,6 +44,7 @@ public class H2SequenceMaxValueIncrementer extends AbstractSequenceMaxValueIncre
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getSequenceQuery() {
|
||||
return "select " + getIncrementerName() + ".nextval from dual";
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public class HsqlMaxValueIncrementer extends AbstractColumnMaxValueIncrementer {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected synchronized long getNextKey() throws DataAccessException {
|
||||
if (this.nextValueIndex < 0 || this.nextValueIndex >= getCacheSize()) {
|
||||
/*
|
||||
|
|
|
@ -49,6 +49,7 @@ public class HsqlSequenceMaxValueIncrementer extends AbstractSequenceMaxValueInc
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getSequenceQuery() {
|
||||
return "call next value for " + getIncrementerName();
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ public class MySQLMaxValueIncrementer extends AbstractColumnMaxValueIncrementer
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected synchronized long getNextKey() throws DataAccessException {
|
||||
if (this.maxId == this.nextId) {
|
||||
/*
|
||||
|
|
|
@ -45,6 +45,7 @@ public class OracleSequenceMaxValueIncrementer extends AbstractSequenceMaxValueI
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getSequenceQuery() {
|
||||
return "select " + getIncrementerName() + ".nextval from dual";
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ public class PostgreSQLSequenceMaxValueIncrementer extends AbstractSequenceMaxVa
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getSequenceQuery() {
|
||||
return "select nextval('" + getIncrementerName() + "')";
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ public class SqlServerMaxValueIncrementer extends AbstractColumnMaxValueIncremen
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected synchronized long getNextKey() throws DataAccessException {
|
||||
if (this.nextValueIndex < 0 || this.nextValueIndex >= getCacheSize()) {
|
||||
/*
|
||||
|
|
|
@ -73,6 +73,7 @@ public class SybaseMaxValueIncrementer extends AbstractColumnMaxValueIncrementer
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected synchronized long getNextKey() throws DataAccessException {
|
||||
if (this.nextValueIndex < 0 || this.nextValueIndex >= getCacheSize()) {
|
||||
/*
|
||||
|
|
|
@ -55,11 +55,13 @@ public class SpringLobCreatorSynchronization extends TransactionSynchronizationA
|
|||
this.lobCreator = lobCreator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return LOB_CREATOR_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeCompletion() {
|
||||
// Close the LobCreator early if possible, to avoid issues with strict JTA
|
||||
// implementations that issue warnings when doing JDBC operations after
|
||||
|
@ -68,6 +70,7 @@ public class SpringLobCreatorSynchronization extends TransactionSynchronizationA
|
|||
this.lobCreator.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
if (!this.beforeCompletionCalled) {
|
||||
// beforeCompletion not called before (probably because of flushing on commit
|
||||
|
|
|
@ -71,14 +71,17 @@ public class C3P0NativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeStatements() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativePreparedStatements() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeCallableStatements() {
|
||||
return true;
|
||||
}
|
||||
|
@ -89,6 +92,7 @@ public class C3P0NativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
* raw Connection (which is otherwise not directly supported by C3P0).
|
||||
* @see #getRawConnection
|
||||
*/
|
||||
@Override
|
||||
protected Connection doGetNativeConnection(Connection con) throws SQLException {
|
||||
if (con instanceof C3P0ProxyConnection) {
|
||||
C3P0ProxyConnection cpCon = (C3P0ProxyConnection) con;
|
||||
|
|
|
@ -84,22 +84,27 @@ public class CommonsDbcpNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Connection doGetNativeConnection(Connection con) throws SQLException {
|
||||
return (Connection) getInnermostDelegate(con);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement getNativeStatement(Statement stmt) throws SQLException {
|
||||
return (Statement) getInnermostDelegate(stmt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement getNativePreparedStatement(PreparedStatement ps) throws SQLException {
|
||||
return (PreparedStatement) getNativeStatement(ps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableStatement getNativeCallableStatement(CallableStatement cs) throws SQLException {
|
||||
return (CallableStatement) getNativeStatement(cs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getNativeResultSet(ResultSet rs) throws SQLException {
|
||||
return (ResultSet) getInnermostDelegate(rs);
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ public class JBossNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Retrieve the Connection via JBoss' <code>getUnderlyingConnection</code> method.
|
||||
*/
|
||||
@Override
|
||||
protected Connection doGetNativeConnection(Connection con) throws SQLException {
|
||||
if (this.wrappedConnectionClass.isAssignableFrom(con.getClass())) {
|
||||
return (Connection) ReflectionUtils.invokeJdbcMethod(this.getUnderlyingConnectionMethod, con);
|
||||
|
@ -103,6 +104,7 @@ public class JBossNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Retrieve the Connection via JBoss' <code>getUnderlyingStatement</code> method.
|
||||
*/
|
||||
@Override
|
||||
public Statement getNativeStatement(Statement stmt) throws SQLException {
|
||||
if (this.wrappedStatementClass.isAssignableFrom(stmt.getClass())) {
|
||||
return (Statement) ReflectionUtils.invokeJdbcMethod(this.getUnderlyingStatementMethod, stmt);
|
||||
|
@ -113,6 +115,7 @@ public class JBossNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Retrieve the Connection via JBoss' <code>getUnderlyingStatement</code> method.
|
||||
*/
|
||||
@Override
|
||||
public PreparedStatement getNativePreparedStatement(PreparedStatement ps) throws SQLException {
|
||||
return (PreparedStatement) getNativeStatement(ps);
|
||||
}
|
||||
|
@ -120,6 +123,7 @@ public class JBossNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Retrieve the Connection via JBoss' <code>getUnderlyingStatement</code> method.
|
||||
*/
|
||||
@Override
|
||||
public CallableStatement getNativeCallableStatement(CallableStatement cs) throws SQLException {
|
||||
return (CallableStatement) getNativeStatement(cs);
|
||||
}
|
||||
|
@ -127,6 +131,7 @@ public class JBossNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Retrieve the Connection via JBoss' <code>getUnderlyingResultSet</code> method.
|
||||
*/
|
||||
@Override
|
||||
public ResultSet getNativeResultSet(ResultSet rs) throws SQLException {
|
||||
if (this.wrappedResultSetClass.isAssignableFrom(rs.getClass())) {
|
||||
return (ResultSet) ReflectionUtils.invokeJdbcMethod(this.getUnderlyingResultSetMethod, rs);
|
||||
|
|
|
@ -40,22 +40,27 @@ import java.sql.Statement;
|
|||
*/
|
||||
public class Jdbc4NativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
||||
|
||||
@Override
|
||||
protected Connection doGetNativeConnection(Connection con) throws SQLException {
|
||||
return (Connection) con.unwrap(Connection.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement getNativeStatement(Statement stmt) throws SQLException {
|
||||
return (Statement) stmt.unwrap(Statement.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement getNativePreparedStatement(PreparedStatement ps) throws SQLException {
|
||||
return (PreparedStatement) ps.unwrap(PreparedStatement.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableStatement getNativeCallableStatement(CallableStatement cs) throws SQLException {
|
||||
return (CallableStatement) cs.unwrap(CallableStatement.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultSet getNativeResultSet(ResultSet rs) throws SQLException {
|
||||
return (ResultSet) rs.unwrap(ResultSet.class);
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ public class SimpleNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
this.nativeConnectionNecessaryForNativeStatements = nativeConnectionNecessaryForNativeStatements;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeStatements() {
|
||||
return this.nativeConnectionNecessaryForNativeStatements;
|
||||
}
|
||||
|
@ -114,6 +115,7 @@ public class SimpleNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
this.nativeConnectionNecessaryForNativePreparedStatements = nativeConnectionNecessary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativePreparedStatements() {
|
||||
return this.nativeConnectionNecessaryForNativePreparedStatements;
|
||||
}
|
||||
|
@ -134,6 +136,7 @@ public class SimpleNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
this.nativeConnectionNecessaryForNativeCallableStatements = nativeConnectionNecessary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeCallableStatements() {
|
||||
return this.nativeConnectionNecessaryForNativeCallableStatements;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ public class WebLogicNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Return <code>true</code>, as WebLogic returns wrapped Statements.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeStatements() {
|
||||
return true;
|
||||
}
|
||||
|
@ -77,6 +78,7 @@ public class WebLogicNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Return <code>true</code>, as WebLogic returns wrapped PreparedStatements.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativePreparedStatements() {
|
||||
return true;
|
||||
}
|
||||
|
@ -84,6 +86,7 @@ public class WebLogicNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Return <code>true</code>, as WebLogic returns wrapped CallableStatements.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeCallableStatements() {
|
||||
return true;
|
||||
}
|
||||
|
@ -91,6 +94,7 @@ public class WebLogicNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Retrieve the Connection via WebLogic's <code>getVendorConnection</code> method.
|
||||
*/
|
||||
@Override
|
||||
protected Connection doGetNativeConnection(Connection con) throws SQLException {
|
||||
if (this.jdbcExtensionClass.isAssignableFrom(con.getClass())) {
|
||||
return (Connection) ReflectionUtils.invokeJdbcMethod(this.getVendorConnectionMethod, con);
|
||||
|
|
|
@ -73,6 +73,7 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Return <code>true</code>, as WebSphere returns wrapped Statements.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeStatements() {
|
||||
return true;
|
||||
}
|
||||
|
@ -80,6 +81,7 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Return <code>true</code>, as WebSphere returns wrapped PreparedStatements.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativePreparedStatements() {
|
||||
return true;
|
||||
}
|
||||
|
@ -87,6 +89,7 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Return <code>true</code>, as WebSphere returns wrapped CallableStatements.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeCallableStatements() {
|
||||
return true;
|
||||
}
|
||||
|
@ -94,6 +97,7 @@ public class WebSphereNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
/**
|
||||
* Retrieve the Connection via WebSphere's <code>getNativeConnection</code> method.
|
||||
*/
|
||||
@Override
|
||||
protected Connection doGetNativeConnection(Connection con) throws SQLException {
|
||||
if (this.webSphere5ConnectionClass.isAssignableFrom(con.getClass())) {
|
||||
return (Connection) ReflectionUtils.invokeJdbcMethod(
|
||||
|
|
|
@ -46,6 +46,7 @@ public class XAPoolNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
* Return <code>true</code>, as CoreStatement does not allow access to the
|
||||
* underlying Connection.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeStatements() {
|
||||
return true;
|
||||
}
|
||||
|
@ -54,10 +55,12 @@ public class XAPoolNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
* Return <code>true</code>, as CoreCallableStatement does not allow access to the
|
||||
* underlying Connection.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeConnectionNecessaryForNativeCallableStatements() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Connection doGetNativeConnection(Connection con) throws SQLException {
|
||||
if (con instanceof CoreConnection) {
|
||||
return ((CoreConnection) con).con;
|
||||
|
@ -65,6 +68,7 @@ public class XAPoolNativeJdbcExtractor extends NativeJdbcExtractorAdapter {
|
|||
return con;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement getNativePreparedStatement(PreparedStatement ps) throws SQLException {
|
||||
if (ps instanceof CorePreparedStatement) {
|
||||
return ((CorePreparedStatement) ps).ps;
|
||||
|
|
|
@ -90,6 +90,7 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
|
|||
|
||||
public SqlXmlValue newSqlXmlValue(final String value) {
|
||||
return new AbstractJdbc4SqlXmlValue() {
|
||||
@Override
|
||||
protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
|
||||
xmlObject.setString(value);
|
||||
}
|
||||
|
@ -98,6 +99,7 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
|
|||
|
||||
public SqlXmlValue newSqlXmlValue(final XmlBinaryStreamProvider provider) {
|
||||
return new AbstractJdbc4SqlXmlValue() {
|
||||
@Override
|
||||
protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
|
||||
provider.provideXml(xmlObject.setBinaryStream());
|
||||
}
|
||||
|
@ -106,6 +108,7 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
|
|||
|
||||
public SqlXmlValue newSqlXmlValue(final XmlCharacterStreamProvider provider) {
|
||||
return new AbstractJdbc4SqlXmlValue() {
|
||||
@Override
|
||||
protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
|
||||
provider.provideXml(xmlObject.setCharacterStream());
|
||||
}
|
||||
|
@ -114,6 +117,7 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
|
|||
|
||||
public SqlXmlValue newSqlXmlValue(final Class resultClass, final XmlResultProvider provider) {
|
||||
return new AbstractJdbc4SqlXmlValue() {
|
||||
@Override
|
||||
protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
|
||||
provider.provideXml(xmlObject.setResult(resultClass));
|
||||
}
|
||||
|
@ -122,6 +126,7 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
|
|||
|
||||
public SqlXmlValue newSqlXmlValue(final Document document) {
|
||||
return new AbstractJdbc4SqlXmlValue() {
|
||||
@Override
|
||||
protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
|
||||
((DOMResult) xmlObject.setResult(DOMResult.class)).setNode(document);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue