Example usage for org.springframework.integration.jdbc StoredProcExecutor setSqlParameters

List of usage examples for org.springframework.integration.jdbc StoredProcExecutor setSqlParameters

Introduction

In this page you can find the example usage for org.springframework.integration.jdbc StoredProcExecutor setSqlParameters.

Prototype

public void setSqlParameters(List<SqlParameter> sqlParameters) 

Source Link

Document

If you database system is not fully supported by Spring and thus obtaining parameter definitions from the JDBC Meta-data is not possible, you must define the SqlParameter explicitly.

Usage

From source file:org.springframework.integration.jdbc.StoredProcExecutorTests.java

@Test
public void testSetSqlParametersWithNullValueInList() {

    DataSource datasource = mock(DataSource.class);
    StoredProcExecutor storedProcExecutor = new StoredProcExecutor(datasource);

    List<SqlParameter> sqlParameters = new ArrayList<SqlParameter>();
    sqlParameters.add(null);//from  w  ww  .  ja v a2 s .co m

    try {
        storedProcExecutor.setSqlParameters(sqlParameters);
    } catch (IllegalArgumentException e) {
        assertEquals("The provided list (sqlParameters) cannot contain null values.", e.getMessage());
        return;
    }

    fail("Exception expected.");

}

From source file:org.springframework.integration.jdbc.StoredProcExecutorTests.java

@Test
public void testSetSqlParametersWithEmptyList() {

    DataSource datasource = mock(DataSource.class);
    StoredProcExecutor storedProcExecutor = new StoredProcExecutor(datasource);

    List<SqlParameter> sqlParameters = new ArrayList<SqlParameter>();

    try {//from  w  ww. j a v a  2  s.  co m
        storedProcExecutor.setSqlParameters(sqlParameters);
    } catch (IllegalArgumentException e) {
        assertEquals("sqlParameters must not be null or empty.", e.getMessage());
        return;
    }

    fail("Exception expected.");

}

From source file:org.springframework.integration.jdbc.StoredProcExecutorTests.java

@Test
public void testSetSqlParametersWithNullList() {

    DataSource datasource = mock(DataSource.class);
    StoredProcExecutor storedProcExecutor = new StoredProcExecutor(datasource);

    try {// ww  w.jav a2  s .  c om
        storedProcExecutor.setSqlParameters(null);
    } catch (IllegalArgumentException e) {
        assertEquals("sqlParameters must not be null or empty.", e.getMessage());
        return;
    }

    fail("Exception expected.");

}