Examples of queryForObject()


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

     */
    public String getUserPassword(Long userId) {
        JdbcTemplate jdbcTemplate =
                new JdbcTemplate(SessionFactoryUtils.getDataSource(getSessionFactory()));
        Table table = AnnotationUtils.findAnnotation(User.class, Table.class);
        return jdbcTemplate.queryForObject(
                "select password from " + table.name() + " where id=?", String.class, userId);
    }
}
View Full Code Here

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

        assertEquals("virtualvalue", userTO.getVirtualAttributeMap().get("virtualdata").getValues().get(0));

        try {
            final JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);

            String value = jdbcTemplate.queryForObject(
                    "SELECT USERNAME FROM testsync WHERE ID=?", String.class, userTO.getId());
            assertEquals("virtualvalue", value);
        } catch (EmptyResultDataAccessException e) {
            fail();
        }
View Full Code Here

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

    updateDatabase(DROP_SCHEMA);
  }

  private void checkStoredMessage(String message) {
    JdbcTemplate template=new JdbcTemplate(getDataSource());
    String storedMessage=(String)template.queryForObject(SELECT_FIELD_REQUEST,
        new Object[] {new Integer(FIELD_ID)},
        new int[] {Types.INTEGER},String.class);
    assertEquals(message,storedMessage);
  }
View Full Code Here

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

    updateDatabase(DROP_SCHEMA);
  }

  private void checkStoredMessage(String message) {
    JdbcTemplate template=new JdbcTemplate(getDataSource());
    String storedMessage=(String)template.queryForObject(SELECT_FIELD_REQUEST,
        new Object[] {new Integer(FIELD_ID)},
        new int[] {Types.INTEGER},String.class);
    assertEquals(message,storedMessage);
  }
View Full Code Here

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

        // 6. check that rejected user was not propagated to external resource (SYNCOPE-364)
        JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
        Exception exception = null;
        try {
            jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?",
                    new String[] {userTO.getUsername()}, Integer.class);
        } catch (EmptyResultDataAccessException e) {
            exception = e;
        }
        assertNotNull(exception);
View Full Code Here

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

        assertEquals("active", userTO.getStatus());
        assertEquals(Collections.singleton("resource-testdb"), userTO.getResources());

        exception = null;
        try {
            final String username = jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?", String.class, userTO.
                    getUsername());
            assertEquals(userTO.getUsername(), username);
        } catch (EmptyResultDataAccessException e) {
            exception = e;
        }
View Full Code Here

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

        assertEquals(1, userTO.getResources().size());

        JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);

        String username =
                jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?", String.class, userTO.getUsername());

        assertEquals(userTO.getUsername(), username);

        UserMod userMod = new UserMod();
View Full Code Here

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

        userTO = restTemplate.postForObject(BASE_URL + "user/update", userMod, UserTO.class);

        assertTrue(userTO.getResources().isEmpty());

        jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?", String.class, userTO.getUsername());
    }

    @Test
    public void issue234() {
        UserTO userTO = getSampleTO("issue234@syncope.apache.org");
View Full Code Here

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

        Exception exception = null;
        try {
            final JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);

            String value = jdbcTemplate.queryForObject(
                    "SELECT USERNAME FROM testsync WHERE ID=?", String.class, actual.getId());
            assertEquals("virattrcache", value);

            jdbcTemplate.update("UPDATE testsync set USERNAME='virattrcache2' WHERE ID=?", userTO.getId());
View Full Code Here

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

                    "SELECT USERNAME FROM testsync WHERE ID=?", String.class, actual.getId());
            assertEquals("virattrcache", value);

            jdbcTemplate.update("UPDATE testsync set USERNAME='virattrcache2' WHERE ID=?", userTO.getId());

            value = jdbcTemplate.queryForObject(
                    "SELECT USERNAME FROM testsync WHERE ID=?", String.class, userTO.getId());
            assertEquals("virattrcache2", value);

        } catch (EmptyResultDataAccessException e) {
            exception = e;
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.