Package org.springframework.jdbc.core.simple

Examples of org.springframework.jdbc.core.simple.SimpleJdbcCall


      "{call " + NO_SUCH_PROC + "()}");
    ctrlConnection.setReturnValue(mockCallable);

    replay();

    SimpleJdbcCall sproc = new SimpleJdbcCall(mockDataSource).withProcedureName(NO_SUCH_PROC);
    try {
      sproc.execute();
      fail("Shouldn't succeed in running stored procedure which doesn't exist");
    } catch (BadSqlGrammarException ex) {
      // OK
    }
  }
View Full Code Here


  public void testUnnamedParameterHandling() throws Exception {
    final String MY_PROC = "my_proc";

    replay();

    SimpleJdbcCall sproc = new SimpleJdbcCall(mockDataSource).withProcedureName(MY_PROC);
    try {
      sproc.addDeclaredParameter(new SqlParameter(1));
      fail("Shouldn't succeed in adding unnamed parameter");
    } catch (InvalidDataAccessApiUsageException ex) {
      // OK
    }
  }
View Full Code Here

      "{call add_invoice(?, ?, ?)}");
    ctrlConnection.setReturnValue(mockCallable);

    replay();

    SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withProcedureName("add_invoice");
    adder.declareParameters(new SqlParameter("amount", Types.INTEGER),
        new SqlParameter("custid", Types.INTEGER),
        new SqlOutParameter("newid", Types.INTEGER));
    Number newId = adder.executeObject(Number.class, new MapSqlParameterSource()
        .addValue("amount", amount)
        .addValue("custid", custid));
    assertEquals(4, newId.intValue());
  }
View Full Code Here

    ctrlConnection.setReturnValue(mockCallable);

    ctrlResultSet.replay();
    replay();

    SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withProcedureName("add_invoice");
    Number newId = adder.executeObject(Number.class, new MapSqlParameterSource()
        .addValue("amount", amount)
        .addValue("custid", custid));
    assertEquals(4, newId.intValue());

    ctrlResultSet.verify();
View Full Code Here

      "{? = call add_invoice(?, ?)}");
    ctrlConnection.setReturnValue(mockCallable);

    replay();

    SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withFunctionName("add_invoice");
    adder.declareParameters(new SqlOutParameter("return", Types.INTEGER),
        new SqlParameter("amount", Types.INTEGER),
        new SqlParameter("custid", Types.INTEGER));
    Number newId = adder.executeFunction(Number.class, new MapSqlParameterSource()
        .addValue("amount", amount)
        .addValue("custid", custid));
    assertEquals(4, newId.intValue());
  }
View Full Code Here

    ctrlConnection.setReturnValue(mockCallable);

    ctrlResultSet.replay();
    replay();

    SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withFunctionName("add_invoice");
    Number newId = adder.executeFunction(Number.class, new MapSqlParameterSource()
        .addValue("amount", amount)
        .addValue("custid", custid));
    assertEquals(4, newId.intValue());

    ctrlResultSet.verify();
View Full Code Here

      "{call " + NO_SUCH_PROC + "()}");
    ctrlConnection.setReturnValue(mockCallable);

    replay();

    SimpleJdbcCall sproc = new SimpleJdbcCall(mockDataSource).withProcedureName(NO_SUCH_PROC);
    try {
      sproc.execute();
      fail("Shouldn't succeed in running stored procedure which doesn't exist");
    } catch (BadSqlGrammarException ex) {
      // OK
    }
  }
View Full Code Here

      "{call add_invoice(?, ?, ?)}");
    ctrlConnection.setReturnValue(mockCallable);

    replay();

    SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withProcedureName("add_invoice");
    adder.declareParameters(new SqlParameter("amount", Types.INTEGER),
        new SqlParameter("custid", Types.INTEGER),
        new SqlOutParameter("newid", Types.INTEGER));
    Number newId = adder.executeObject(Number.class, new MapSqlParameterSource()
        .addValue("amount", amount)
        .addValue("custid", custid));
    assertEquals(4, newId.intValue());
  }
View Full Code Here

    ctrlConnection.setReturnValue(mockCallable);

    ctrlResultSet.replay();
    replay();

    SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withProcedureName("add_invoice");
    Number newId = adder.executeObject(Number.class, new MapSqlParameterSource()
        .addValue("amount", amount)
        .addValue("custid", custid));
    assertEquals(4, newId.intValue());

    ctrlResultSet.verify();
View Full Code Here

      "{? = call add_invoice(?, ?)}");
    ctrlConnection.setReturnValue(mockCallable);

    replay();

    SimpleJdbcCall adder = new SimpleJdbcCall(mockDataSource).withFunctionName("add_invoice");
    adder.declareParameters(new SqlOutParameter("return", Types.INTEGER),
        new SqlParameter("amount", Types.INTEGER),
        new SqlParameter("custid", Types.INTEGER));
    Number newId = adder.executeFunction(Number.class, new MapSqlParameterSource()
        .addValue("amount", amount)
        .addValue("custid", custid));
    assertEquals(4, newId.intValue());
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.simple.SimpleJdbcCall

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.