Example usage for org.springframework.jdbc.core JdbcTemplate query

List of usage examples for org.springframework.jdbc.core JdbcTemplate query

Introduction

In this page you can find the example usage for org.springframework.jdbc.core JdbcTemplate query.

Prototype

@Override
    public <T> List<T> query(PreparedStatementCreator psc, RowMapper<T> rowMapper) throws DataAccessException 

Source Link

Usage

From source file:com.dai.dao.JogoDaoImpl.java

@Override
public List<Jogo> listaJogosPendentes() {
    List<Jogo> utList = new ArrayList();

    String sql = "select * from jogo where resultadoJogo is null";

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    utList = jdbcTemplate.query(sql, new JogoRowMapper());
    return utList;
}

From source file:com.dai.dao.EscalaoDaoImpl.java

@Override
public List<Escalao> listarEscalao() {
    List<Escalao> le = new ArrayList();
    JdbcTemplate template = new JdbcTemplate(dataSource);
    le = template.query("SELECT * FROM escalao", new EscalaoRowMapper());
    return le;/*from   w w w. ja va2 s.  c  o  m*/
}

From source file:com.dai.dao.PerfilDaoImpl.java

@Override
public List<Perfil> listarPerfil() {
    List<Perfil> lp = new ArrayList();
    JdbcTemplate template = new JdbcTemplate(dataSource);
    lp = template.query("SELECT * FROM perfil", new PerfilRowMapper());
    return lp;/*from   w  ww .ja v a  2s.  c  o m*/
}

From source file:com.dai.dao.SelecaoJogoDaoImpl.java

public List<SelecaoJogo> listaSL(int idJogo) {

    List<SelecaoJogo> slList = new ArrayList();

    String sql = "select * from selecaoJogo where jogo_idjogo=" + idJogo;

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    slList = jdbcTemplate.query(sql, new SelecaoJogoRowMapper());
    return slList;
}

From source file:com.dai.dao.CompeticaoDaoImpl.java

@Override
public List<Competicao> listaCompeticao() {

    List<Competicao> slList = new ArrayList();

    String sql = "select * from competicao";

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    slList = jdbcTemplate.query(sql, new CompeticaoRowMapper());
    return slList;
}

From source file:com.jaxio.celerio.configuration.database.mysql.MysqlEnumExtension.java

private void processEnums(JdbcTemplate jdbcTemplate, final Metadata metadata, final Table table) {
    jdbcTemplate.query("show columns from " + table.getName() + " where type like 'enum%'",
            new RowMapper<Void>() {
                @Override//from   w w w  . j av a2  s  . com
                public Void mapRow(ResultSet rs, int rowNum) throws SQLException {
                    processEnumType(metadata, table, rs.getString("Field"), rs.getString("Type"));
                    return null;
                }
            });
}

From source file:com.beezas.dao.EventDaoImpl.java

public List<User> getCategories() {
    List categoryList = new ArrayList();
    String sql = "select * from category";
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    categoryList = jdbcTemplate.query(sql, new UserRowMapper());
    return categoryList;
}

From source file:com.beezas.dao.EventDaoImpl.java

public List<SubCategory> getSubCategories() {
    List categoryList = new ArrayList();
    String sql = "select * from sub_category";
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    categoryList = jdbcTemplate.query(sql, new SubCategoryRowMapper());
    return categoryList;
}

From source file:com.jaxio.celerio.configuration.database.mysql.MysqlMetaAttributesExtension.java

private void processYearTypes(JdbcTemplate jdbcTemplate, final Metadata metadata, final Table table) {
    jdbcTemplate.query("show columns from " + table.getName(), new RowMapper<Void>() {
        @Override/*from  w w w . jav  a  2  s .  c om*/
        public Void mapRow(ResultSet rs, int rowNum) throws SQLException {
            Column column = table.getColumnByName(rs.getString("Field"));
            column.addMetaAttribute(new MetaAttribute("type", rs.getString("Type")));
            String extra = rs.getString("Extra");
            if (isNotBlank(extra)) {
                column.addMetaAttribute(new MetaAttribute("extra", trim(extra)));
            }
            return null;
        }
    });
}

From source file:com.beezas.dao.EventDaoImpl.java

public List getAttendees() {
    List attendeesList = new ArrayList();
    String sql = "select * from attendees";
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    attendeesList = jdbcTemplate.query(sql, new AttendRowMapper());
    return attendeesList;
}