当前位置: 首页>>代码示例>>Java>>正文


Java CallableStatementCreator类代码示例

本文整理汇总了Java中org.springframework.jdbc.core.CallableStatementCreator的典型用法代码示例。如果您正苦于以下问题:Java CallableStatementCreator类的具体用法?Java CallableStatementCreator怎么用?Java CallableStatementCreator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CallableStatementCreator类属于org.springframework.jdbc.core包,在下文中一共展示了CallableStatementCreator类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: callInsert

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
private void callInsert(String tokenKey, List<SqlParameter> paramList, byte[] compressedBytes, String procedureSecurestoreInsert) {
    jdbcTemplate.call(new CallableStatementCreator() {
        @Override
        public CallableStatement createCallableStatement(Connection connection) throws SQLException {
            CallableStatement callableStatement = connection.prepareCall(procedureSecurestoreInsert);
            callableStatement.setString(1, OAUTH_ACCESS_TOKEN_STORE);
            callableStatement.setBoolean(2, FOR_XS_APPLICATIONUSER);
            callableStatement.setString(3, tokenKey);
            callableStatement.setBytes(4, compressedBytes);
            return callableStatement;
        }
    }, paramList);
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:14,代码来源:HanaSecureTokenStore.java

示例2: executeBatch

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
@Override
public int[] executeBatch() throws SQLException {

    if (this.batchItems == null) {
        throw new IllegalArgumentException("Batch must have at least one item");
    }

    final Iterator<Map<String, ?>> params = batchItems.iterator();


    return factory.getJdbcTemplate().execute(new CallableStatementCreator() {
        @Override
        public CallableStatement createCallableStatement(Connection connection) throws SQLException {
            return batchFactory.newCallableStatementCreator(params.next()).createCallableStatement(connection);

        }
    }, new CallableStatementCallback<int[]>() {
        @Override
        public int[] doInCallableStatement(CallableStatement callableStatement) throws SQLException, DataAccessException {
            //add first item to batch
            callableStatement.addBatch();

            while (params.hasNext()) {
                batchFactory.addParameter(callableStatement, params.next());
                callableStatement.addBatch();
            }
            return callableStatement.executeBatch();
        }
    });
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:31,代码来源:CallableStatementWrapper.java

示例3: callRetrieve

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
private Map<String, Object> callRetrieve(String tokenKey, List<SqlParameter> paramList, final String procedureSecurestoreRetrieve) {
    Map<String, Object> result = jdbcTemplate.call(new CallableStatementCreator() {
        @Override
        public CallableStatement createCallableStatement(Connection connection) throws SQLException {
            CallableStatement callableStatement = connection.prepareCall(procedureSecurestoreRetrieve);
            callableStatement.setString(1, OAUTH_ACCESS_TOKEN_STORE);
            callableStatement.setBoolean(2, FOR_XS_APPLICATIONUSER);
            callableStatement.setString(3, tokenKey);
            callableStatement.registerOutParameter(4, Types.VARBINARY);
            return callableStatement;
        }
    }, paramList);
    return result;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:15,代码来源:HanaSecureTokenStore.java

示例4: executeCallInternal

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
/**
 * Method to perform the actual call processing
 */
private Map<String, Object> executeCallInternal(Map<String, ?> params) {
	CallableStatementCreator csc = getCallableStatementFactory().newCallableStatementCreator(params);
	if (logger.isDebugEnabled()) {
		logger.debug("The following parameters are used for call " + getCallString() + " with: " + params);
		int i = 1;
		for (SqlParameter p : getCallParameters()) {
			logger.debug(i++ + ": " +  p.getName() + " SQL Type "+ p.getSqlType() + " Type Name " + p.getTypeName() + " " + p.getClass().getName());
		}
	}
	return getJdbcTemplate().call(csc, getCallParameters());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:15,代码来源:AbstractJdbcCall.java

示例5: testStoredProcedureConfiguredViaJdbcTemplateWithCustomExceptionTranslator

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
/**
 * Confirm no connection was used to get metadata. Does not use superclass replay
 * mechanism.
 *
 * @throws Exception
 */
@Test
public void testStoredProcedureConfiguredViaJdbcTemplateWithCustomExceptionTranslator()
		throws Exception {
	given(callableStatement.execute()).willReturn(false);
	given(callableStatement.getUpdateCount()).willReturn(-1);
	given(callableStatement.getObject(2)).willReturn(5);
	given(connection.prepareCall("{call " + StoredProcedureConfiguredViaJdbcTemplate.SQL + "(?, ?)}")
			).willReturn(callableStatement);

	class TestJdbcTemplate extends JdbcTemplate {

		int calls;

		@Override
		public Map<String, Object> call(CallableStatementCreator csc,
				List<SqlParameter> declaredParameters) throws DataAccessException {
			calls++;
			return super.call(csc, declaredParameters);
		}
	}
	TestJdbcTemplate t = new TestJdbcTemplate();
	t.setDataSource(dataSource);
	// Will fail without the following, because we're not able to get a connection
	// from the DataSource here if we need to to create an ExceptionTranslator
	t.setExceptionTranslator(new SQLStateSQLExceptionTranslator());
	StoredProcedureConfiguredViaJdbcTemplate sp = new StoredProcedureConfiguredViaJdbcTemplate(t);

	assertEquals(sp.execute(11), 5);
	assertEquals(1, t.calls);

	verify(callableStatement).setObject(1, 11, Types.INTEGER);
	verify(callableStatement).registerOutParameter(2, Types.INTEGER);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:40,代码来源:StoredProcedureTests.java

示例6: execute

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
public <T> T execute(CallableStatementCreator csc,
    CallableStatementCallback<T> action) throws DataAccessException {
  return delegate.execute(csc, action);
}
 
开发者ID:tramchamploo,项目名称:buffer-slayer,代码行数:5,代码来源:BatchJdbcTemplate.java

示例7: call

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
public Map<String, Object> call(CallableStatementCreator csc,
    List<SqlParameter> declaredParameters) throws DataAccessException {
  return delegate.call(csc, declaredParameters);
}
 
开发者ID:tramchamploo,项目名称:buffer-slayer,代码行数:5,代码来源:BatchJdbcTemplate.java

示例8: callRemove

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
private void callRemove(String tokenKey, List<SqlParameter> paramList, String procedureSecurestoreDelete) {
    jdbcTemplate.call(new CallableStatementCreator() {
        @Override
        public CallableStatement createCallableStatement(Connection connection) throws SQLException {
            CallableStatement callableStatement = connection.prepareCall(procedureSecurestoreDelete);
            callableStatement.setString(1, OAUTH_ACCESS_TOKEN_STORE);
            callableStatement.setBoolean(2, FOR_XS_APPLICATIONUSER);
            callableStatement.setString(3, tokenKey);
            return callableStatement;
        }
    }, paramList);
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:13,代码来源:HanaSecureTokenStore.java

示例9: executeCallInternal

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
/**
 * Delegate method to perform the actual call processing.
 */
private Map<String, Object> executeCallInternal(Map<String, ?> args) {
	CallableStatementCreator csc = getCallableStatementFactory().newCallableStatementCreator(args);
	if (logger.isDebugEnabled()) {
		logger.debug("The following parameters are used for call " + getCallString() + " with " + args);
		int i = 1;
		for (SqlParameter param : getCallParameters()) {
			logger.debug(i + ": " +  param.getName() + ", SQL type "+ param.getSqlType() + ", type name " +
					param.getTypeName() + ", parameter class [" + param.getClass().getName() + "]");
			i++;
		}
	}
	return getJdbcTemplate().call(csc, getCallParameters());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:AbstractJdbcCall.java

示例10: newCallableStatementCreator

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
public CallableStatementCreator newCallableStatementCreator(Map<String, ?> params) {
    return this.callableStatementCreatorFactory.newCallableStatementCreator(params);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:BatchCallableStatementCreatorFactory.java

示例11: execute

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
@Override
public <T> T execute(CallableStatementCreator csc, CallableStatementCallback<T> action) throws DataAccessException {

	return super.execute(csc, action);
}
 
开发者ID:gxianglong,项目名称:kratos-1,代码行数:6,代码来源:KratosJdbcTemplate.java

示例12: call

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
@Override
public Map<String, Object> call(CallableStatementCreator csc, List<SqlParameter> declaredParameters)
		throws DataAccessException {

	return super.call(csc, declaredParameters);
}
 
开发者ID:gxianglong,项目名称:kratos-1,代码行数:7,代码来源:KratosJdbcTemplate.java

示例13: newCallableStatementCreator

import org.springframework.jdbc.core.CallableStatementCreator; //导入依赖的package包/类
/**
 * Return a CallableStatementCreator to perform an operation
 * with this parameters.
 * @param inParams parameters. May be {@code null}.
 */
protected CallableStatementCreator newCallableStatementCreator(Map<String, ?> inParams) {
	return this.callableStatementFactory.newCallableStatementCreator(inParams);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:SqlCall.java


注:本文中的org.springframework.jdbc.core.CallableStatementCreator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。