Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.SqlParameter


    TestRdbmsOperation operation = new TestRdbmsOperation();
    operation.setDataSource(new DriverManagerDataSource());
    operation.setSql("select * from mytable");
    operation.compile();
    try {
      operation.declareParameter(new SqlParameter(Types.INTEGER));
      fail("Shouldn't allow setting parameters after compile");
    }
    catch (InvalidDataAccessApiUsageException idaauex) {
      // OK
    }
View Full Code Here


    TestRdbmsOperation operation = new TestRdbmsOperation();
    DataSource ds = new DriverManagerDataSource();
    operation.setDataSource(ds);
    operation.setSql("select * from mytable where one = ? and two = ?");
    List l = new ArrayList();
    l.add(new SqlParameter("one", Types.NUMERIC));
    l.add(new SqlParameter("two", Types.VARCHAR));
    operation.setParameters(new SqlParameter[] {
        new SqlParameter("one", Types.NUMERIC),
        new SqlParameter("two", Types.NUMERIC)});
    operation.afterPropertiesSet();
    try {
      operation.validateParameters(new Object[] {new Integer(1), new String("2")});
      assertEquals(2, operation.getDeclaredParameters().size());
      // OK
View Full Code Here

  private class IntUpdater extends SqlUpdate {

    public IntUpdater() {
      setSql(UPDATE_INT);
      setDataSource(mockDataSource);
      declareParameter(new SqlParameter(Types.NUMERIC));
      compile();
    }
View Full Code Here

  private class IntIntUpdater extends SqlUpdate {

    public IntIntUpdater() {
      setSql(UPDATE_INT_INT);
      setDataSource(mockDataSource);
      declareParameter(new SqlParameter(Types.NUMERIC));
      declareParameter(new SqlParameter(Types.NUMERIC));
      compile();
    }
View Full Code Here

  private class StringUpdater extends SqlUpdate {

    public StringUpdater() {
      setSql(UPDATE_STRING);
      setDataSource(mockDataSource);
      declareParameter(new SqlParameter(Types.VARCHAR));
      compile();
    }
View Full Code Here

  private class MixedUpdater extends SqlUpdate {

    public MixedUpdater() {
      setSql(UPDATE_OBJECTS);
      setDataSource(mockDataSource);
      declareParameter(new SqlParameter(Types.NUMERIC));
      declareParameter(new SqlParameter(Types.NUMERIC, 2));
      declareParameter(new SqlParameter(Types.VARCHAR));
      declareParameter(new SqlParameter(Types.BOOLEAN));
      compile();
    }
View Full Code Here

  private class GeneratedKeysUpdater extends SqlUpdate {

    public GeneratedKeysUpdater() {
      setSql(INSERT_GENERATE_KEYS);
      setDataSource(mockDataSource);
      declareParameter(new SqlParameter(Types.VARCHAR));
      setReturnGeneratedKeys(true);
      compile();
    }
View Full Code Here

    public static final String SQL = "configured_via_jt";

    public StoredProcedureConfiguredViaJdbcTemplate(JdbcTemplate t) {
      setJdbcTemplate(t);
      setSql(SQL);
      declareParameter(new SqlParameter("intIn", Types.INTEGER));
      declareParameter(new SqlOutParameter("intOut", Types.INTEGER));
      compile();
    }
View Full Code Here

      public CustomerQuery(DataSource ds) {
        super(ds, SELECT_ID_FORENAME_NAMED_PARAMETERS);
        setResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE);
        if (namedDeclarations) {
          declareParameter(new SqlParameter("country", Types.VARCHAR));
          declareParameter(new SqlParameter("id", Types.NUMERIC));
        }
        else {
          declareParameter(new SqlParameter(Types.NUMERIC));
          declareParameter(new SqlParameter(Types.VARCHAR));
        }
        compile();
      }
View Full Code Here

    class CustomerQuery extends MappingSqlQuery {

      public CustomerQuery(DataSource ds) {
        super(ds, SELECT_ID_FORENAME_WHERE_ID_IN_LIST_2);
        setResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE);
        declareParameter(new SqlParameter("ids", Types.NUMERIC));
        compile();
      }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.SqlParameter

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.