Java Code Examples for org.springframework.jdbc.core.JdbcOperations#query()

The following examples show how to use org.springframework.jdbc.core.JdbcOperations#query() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractDeduplicateUsers.java    From find with MIT License 5 votes vote down vote up
private List<User> getAllUserEntities(final JdbcOperations jdbcTemplate) {
    return jdbcTemplate.query("SELECT user_id, username FROM users", (rs, rowNum) -> {
        final String username = rs.getString("username");
        final long userId = rs.getLong("user_id");
        return new User(username, userId);
    });
}
 
Example 2
Source File: AbstractMigrateUsersToIncludeUsernames.java    From find with MIT License 5 votes vote down vote up
private List<DeprecatedUser> getAllUsers(final JdbcOperations jdbcTemplate) {
    return jdbcTemplate.query("SELECT user_id, uid FROM users", (rs, rowNum) -> {
        final Long userId = rs.getLong("user_id");
        final Long uid = rs.getLong("uid");
        return new AbstractMigrateUsersToIncludeUsernames.DeprecatedUser(userId, null, uid);
    });
}