Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcOperations.queryForObject()


    String arg2 = "foo";
    Object arg3 = new Object();

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForObject(sql, new Object[]{arg1, arg2, arg3}, Date.class);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here


      }
    };

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForObject(sql, rm);
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
    Date result = jth.queryForObject(sql, rm);
View Full Code Here

      }
    };

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForObject(sql, new Object[]{arg1, arg2, arg3}, rm);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

      }
    };

    MockControl mc = MockControl.createControl(JdbcOperations.class);
    JdbcOperations jo = (JdbcOperations) mc.getMock();
    jo.queryForObject(sql, new Object[]{arg1, arg2, arg3}, rm);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();

    SimpleJdbcTemplate jth = new SimpleJdbcTemplate(jo);
View Full Code Here

    DataSource dataSource = this.context.getBean(DataSource.class);
    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(1),
        template.queryForObject("SELECT COUNT(*) from BAR", Integer.class));
  }

  @Test
  public void testDataSourceInitializedWithExplicitScript() throws Exception {
    this.context.register(DataSourceAutoConfiguration.class,
View Full Code Here

    DataSource dataSource = this.context.getBean(DataSource.class);
    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(1),
        template.queryForObject("SELECT COUNT(*) from FOO", Integer.class));
  }

  @Test
  public void testDataSourceInitializedWithMultipleScripts() throws Exception {
    EnvironmentTestUtils
View Full Code Here

    DataSource dataSource = this.context.getBean(DataSource.class);
    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(1),
        template.queryForObject("SELECT COUNT(*) from FOO", Integer.class));
    assertEquals(new Integer(0),
        template.queryForObject("SELECT COUNT(*) from SPAM", Integer.class));
  }

  @Test
View Full Code Here

    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(1),
        template.queryForObject("SELECT COUNT(*) from FOO", Integer.class));
    assertEquals(new Integer(0),
        template.queryForObject("SELECT COUNT(*) from SPAM", Integer.class));
  }

  @Test
  public void testDataSourceInitializedWithExplicitSqlScriptEncoding() throws Exception {
    this.context.register(DataSourceAutoConfiguration.class,
View Full Code Here

    DataSource dataSource = this.context.getBean(DataSource.class);
    assertTrue(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource);
    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(2),
        template.queryForObject("SELECT COUNT(*) from BAR", Integer.class));
    assertEquals("bar",
        template.queryForObject("SELECT name from BAR WHERE id=1", String.class));
    assertEquals("ばー",
        template.queryForObject("SELECT name from BAR WHERE id=2", String.class));
  }
View Full Code Here

    assertNotNull(dataSource);
    JdbcOperations template = new JdbcTemplate(dataSource);
    assertEquals(new Integer(2),
        template.queryForObject("SELECT COUNT(*) from BAR", Integer.class));
    assertEquals("bar",
        template.queryForObject("SELECT name from BAR WHERE id=1", String.class));
    assertEquals("ばー",
        template.queryForObject("SELECT name from BAR WHERE id=2", String.class));
  }

  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.