Spring Framework BeanPropertyRowMapper - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework BeanPropertyRowMapper class.

This code example shows how to use the following methods:
 * @see ParameterizedRowMapper 
 * @deprecated along with {@link SimpleJdbcTemplate}, in favor of the regular 
 * {@link org.springframework.jdbc.core.BeanPropertyRowMapper} 
 */ 
@Deprecated 
public class ParameterizedBeanPropertyRowMapper<T> extends BeanPropertyRowMapper<T>
		implements ParameterizedRowMapper<T> {
 
	/** 
	 * Static factory method to create a new ParameterizedBeanPropertyRowMapper 
	 * (with the mapped class specified only once). 
	 * @param mappedClass the class that each row should be mapped to 
	 */ 
	public static <T> ParameterizedBeanPropertyRowMapper<T> newInstance(Class<T> mappedClass) {
		ParameterizedBeanPropertyRowMapper<T> newInstance = new ParameterizedBeanPropertyRowMapper<T>();
		newInstance.setMappedClass(mappedClass);
		return newInstance;
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:
        setDataSource(dataSource); 
    } 
     
    @Override 
    public List<User> listarTodos() { 
        return getJdbcTemplate().query( 
                "select * from sunat_user", 
                new BeanPropertyRowMapper<User>(User.class)); 
    } 
 
    @Override 
    public Integer insertar(User object) { 
        getJdbcTemplate().update( 
                "insert into sunat_user(full_name, username, salt, password," 
                + "email, is_active) values(?, ?, ?, ?, ?, ?)", 
                object.getFullname(), object.getUsername(), object.getSalt(), 
                object.getPassword(), object.getEmail(), object.getActive()); 
        return getJdbcTemplate().queryForInt("select last_insert_id()"); 
    } 
 
4
CodeRank
This code example shows how to use the following methods:
 
	@Override 
	public Movie find(Integer id) { 
		Movie movie = null; 
		try{ 
			movie =  getSimpleJdbcTemplate().queryForObject( 
					"select id, title, description, director, genre, languages," + 
							" starring, duration, year from movies where id=?", 
							new BeanPropertyRowMapper<Movie>(Movie.class), id); 
		}catch(EmptyResultDataAccessException ex){ 
			logger.debug("Records not found for id " + id); 
		} 
		return movie; 
	} 
 
	@Override 
	public List<Movie> findAll() { 
		return getSimpleJdbcTemplate().query( 
				"select id, title, description, director, genre, languages," + 
				" starring, duration, year from movies", 
4
CodeRank
This code example shows how to use the following methods:
    } 
     
    @Override 
    public List<Concept> listarTodos() { 
        try{ 
            return getJdbcTemplate().query("select * from sunat_concept ",  
                    new BeanPropertyRowMapper<Concept>(Concept.class)); 
        }catch (EmptyResultDataAccessException e){ 
            return null; 
        } 
    } 
 
    @Override 
    public Integer insertar(Concept object) { 
        getJdbcTemplate().update( 
                "insert into sunat_concept(name) values(?)", 
                object.getName()); 
        Integer id = getJdbcTemplate().queryForInt("Select last_insert_id()"); 
        object.setId(id); 
        return id; 
4
CodeRank
This code example shows how to use the following methods:
		stream().create(streamName, "%s | %s", httpSource, jdbcSink);
		String json = "{\"foo\":5, \"bar\": \"hello\"}";
		httpSource.ensureReady().postData(json);
 
		String query = String.format("SELECT foo, bar FROM %s", streamName);
		Result result = jdbcSink.getJdbcTemplate().queryForObject(query, new BeanPropertyRowMapper<>(Result.class));
		assertEquals("hello", result.getBar());
		assertEquals(5, result.getFoo());
	} 
 
	@Test
	public void testJdbcSinkWithCustomColumnNamesWithUnderscores() throws Exception {
		JdbcSink jdbcSink = newJdbcSink().columns("foo_bar,bar_foo,bar_baz");
 
		HttpSource httpSource = newHttpSource();
 
		String streamName = generateStreamName().replaceAll("-", "_");
		stream().create(streamName, "%s | %s", httpSource, jdbcSink);
		String json = "{\"fooBar\":5, \"barFoo\": \"hello\", \"bar_baz\": \"good_bye\"}";
		httpSource.ensureReady().postData(json);
4
CodeRank
This code example shows how to use the following methods:
	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(*) "); 
	} 
	 
	public Page pageQuery(String query,PageRequest pageRequest,RowMapper rowMapper, String countQuerySelectPrefix) { 
		String countQuery = countQuerySelectPrefix + SqlRemoveUtils.removeSelect(query); 
		return pageQuery(query,countQuery,pageRequest,rowMapper); 
	} 
	 
	public Page pageQuery(String query,PageRequest pageRequest,String countQueryPrefix,RowMapper rowMapper) { 
		String countQuery = countQueryPrefix + SqlRemoveUtils.removeSelect(query); 
		return pageQuery(query,countQuery,pageRequest,rowMapper); 
	} 
	 
	public Page pageQuery(String query,String countQuery,final PageRequest pageRequest,RowMapper rowMapper) { 
		final int totalCount = queryTotalCount(countQuery,pageRequest); 
4
CodeRank
This code example shows how to use the following methods:
                    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) {
                result = data.get(0);
            } 
        } 
 
        // If data.size is zero, let result be null. 
        return result;
    } 
 
} 
4
CodeRank