Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.BeanPropertyRowMapper


    }

    @Override
    public User findOne(Long userId) {
        String sql = "select id, username, password, salt from oauth2_user where id=?";
        List<User> userList = jdbcTemplate.query(sql, new BeanPropertyRowMapper(User.class), userId);
        if(userList.size() == 0) {
            return null;
        }
        return userList.get(0);
    }
View Full Code Here


    }

    @Override
    public List<User> findAll() {
        String sql = "select id, username, password, salt from oauth2_user";
        return jdbcTemplate.query(sql, new BeanPropertyRowMapper(User.class));
    }
View Full Code Here


    @Override
    public User findByUsername(String username) {
        String sql = "select id, username, password, salt from oauth2_user where username=?";
        List<User> userList = jdbcTemplate.query(sql, new BeanPropertyRowMapper(User.class), username);
        if(userList.size() == 0) {
            return null;
        }
        return userList.get(0);
    }
View Full Code Here


    @Override
    public User findOne(Long userId) {
        String sql = "select id, username, password, salt, locked from sys_users where id=?";
        List<User> userList = getJdbcTemplate().query(sql, new BeanPropertyRowMapper(User.class), userId);
        if(userList.size() == 0) {
            return null;
        }
        return userList.get(0);
    }
View Full Code Here

    }

    @Override
    public User findByUsername(String username) {
        String sql = "select id, username, password, salt, locked from sys_users where username=?";
        List<User> userList = getJdbcTemplate().query(sql, new BeanPropertyRowMapper(User.class), username);
        if(userList.size() == 0) {
            return null;
        }
        return userList.get(0);
    }
View Full Code Here

                    result = row;
                }
            }
        } else {
            Class<?> outputClzz = getCamelContext().getClassResolver().resolveClass(outputClass);
            RowMapper rowMapper = new BeanPropertyRowMapper(outputClzz);
            RowMapperResultSetExtractor<?> mapper = new RowMapperResultSetExtractor(rowMapper);
            List<?> data = mapper.extractData(rs);
            if (data.size() > 1) {
                throw new SQLDataException("Query result not unique for outputType=SelectOne. Got " + data.size() " count instead.");
            } else if (data.size() == 1) {
View Full Code Here

  public Page findAll(String tableName,final PageRequest pageRequest) {
    return pageQuery("select * from "+tableName+" /~ order by [sortColumns] ~/",pageRequest);
  }
 
  public Page pageQuery(String query,PageRequest pageRequest) {
    return pageQuery(query,pageRequest,new BeanPropertyRowMapper(getEntityClass()), "select count(*) ");
  }
View Full Code Here

  }
 
  public E getById(PK id) {
    List list = null;
    if(getSqlGenerator().getTable().getPrimaryKeyCount() > 1) {
      list = getNamedParameterJdbcTemplate().query(getSqlGenerator().getSelectByPkSql(), new BeanPropertySqlParameterSource(id), new BeanPropertyRowMapper(getEntityClass()));
    }else if(getSqlGenerator().getTable().getPrimaryKeyCount() == 1){
      list = getSimpleJdbcTemplate().query(getSqlGenerator().getSelectByPkSql(), ParameterizedBeanPropertyRowMapper.newInstance(getEntityClass()), id);
    }else {
      throw new IllegalStateException("not found primary key on table:"+getSqlGenerator().getTable().getTableName());
    }
View Full Code Here

TOP

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

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.