Example usage for java.sql ResultSet getInt

List of usage examples for java.sql ResultSet getInt

Introduction

In this page you can find the example usage for java.sql ResultSet getInt.

Prototype

int getInt(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.

Usage

From source file:com.javacodegags.waterflooding.model.ThermImplemented.java

@Override
public List<Therm> getList() {
    String sql = "SELECT therm_set.id,therm_set.name " + "FROM therm_set ;";
    List<Therm> listTherm = jdbcTemplate.query(sql, new RowMapper<Therm>() {
        @Override//  w w w . j ava  2s .  c o  m
        public Therm mapRow(ResultSet rs, int i) throws SQLException {
            Therm therm = new Therm();
            therm.setId(rs.getInt("id"));
            therm.setName(rs.getString("name"));
            return therm;
        }
    });
    return listTherm;
}

From source file:com.leapfrog.sms.dao.impl.CourseDAOImpl.java

private Course mapData(ResultSet rs) throws SQLException {
    Course course = new Course();
    course.setId(rs.getInt("id"));
    course.setName(rs.getString("name"));
    course.setDescription(rs.getString("description"));
    course.setPrice(rs.getDouble("price"));
    course.setStatus(rs.getBoolean("status"));
    return course;
}

From source file:edu.pitt.sis.infsci2730.finalProject.utils.ProductCategoryRowMapper.java

public ProductCategoryDBModel mapRow(ResultSet rs, int index) throws SQLException {
    ProductCategoryDBModel productCategory = new ProductCategoryDBModel();

    productCategory.setCategory_id(rs.getInt("CATEGORY_ID"));
    productCategory.setCategory_name(rs.getString("CATEGORY_NAME"));

    return productCategory;
}

From source file:com.wabacus.system.datatype.IntType.java

public Object getColumnValue(ResultSet rs, int iindex, AbsDatabaseType dbtype) throws SQLException {
    return Integer.valueOf(rs.getInt(iindex));
}

From source file:com.company.dao.impl.StudentDAOImpl.java

private Student mapData(ResultSet rs) throws SQLException {
    Student student = new Student();
    student.setId(rs.getInt("id"));
    student.setFirstName(rs.getString("first_name"));
    student.setLastName(rs.getString("last_name"));
    student.setEmail(rs.getString("email"));
    student.setContactNo(rs.getString("contact_no"));
    student.setGender(rs.getString("gender"));
    student.setDob(rs.getDate("dob"));
    student.setStatus(rs.getBoolean("status"));
    student.setAddedDate(rs.getDate("added_date"));
    student.setModifedDate(rs.getDate("modified_date"));
    student.setDeletedDate(rs.getDate("delete_date"));
    student.setDeleteIP(rs.getString("delete_ip"));
    return student;
}

From source file:info.gewton.slsecurity.dao.support.DefaultPostDao.java

@Override
public List<Post> retrieveByUser(final PostUser u) {
    return getJdbcTemplate().query(SQL_RETRIEVE_BY_USER, new String[] { u.getUsername() },
            new ParameterizedRowMapper<Post>() {
                public Post mapRow(ResultSet rs, int rowNum) throws SQLException {
                    Post p = new Post();
                    p.setId(rs.getInt(1));
                    p.setTimestamp(rs.getDate(2));
                    p.setText(rs.getString(3));
                    p.setUser(u);/*ww  w .  j a v a2s  . c  o m*/
                    return p;
                }
            });
}

From source file:com.karki.spring.dao.impl.CourseDaoImpl.java

private Course mapData(ResultSet rs) throws SQLException {
    Course course = new Course();
    course.setId(rs.getInt("id"));
    course.setCourseName(rs.getString("course_name"));
    course.setCourseDescription(rs.getString("course_description"));
    course.setDurationType(rs.getString("duration_type"));
    course.setFees(rs.getDouble("fees"));
    course.setDuration(rs.getInt("duration"));
    course.setAddedDate(rs.getDate("added_date"));
    course.setModifiedDate(rs.getDate("modified_date"));
    course.setStatus(rs.getBoolean("status"));
    return course;
}

From source file:org.jasig.schedassist.impl.owner.PersistencePreferenceRowMapper.java

public PersistencePreference mapRow(ResultSet rs, int rowNum) throws SQLException {
    PersistencePreference preference = new PersistencePreference();
    preference.setOwnerId(rs.getInt("owner_id"));
    preference.setPreferenceKey(rs.getString("preference_key"));
    preference.setPreferenceValue(rs.getString("preference_value"));
    return preference;
}

From source file:ru.org.linux.topic.LastMiniNewsDao.java

public List<LastMiniNews> getTopics(final int perPage) {
    String sql = "select topics.id as msgid, groups.urlname, groups.section, topics.title, lastmod, topics.stat1 as c  "
            + "from topics " + "join groups on groups.id = topics.groupid" + " where "
            + "  topics.postdate>(CURRENT_TIMESTAMP-'1 month 1 day'::interval) and " + //  ? ??
            "  not deleted and " + // ?
            "  groups.section = 1 and topics.moderate and commitdate is not null and not draft " + // ??
            "  and minor order by topics.commitdate desc limit 10"; // 10 

    return jdbcTemplate.query(sql, new RowMapper<LastMiniNews>() {
        @Override/*  w  ww. ja  v  a 2  s . co m*/
        public LastMiniNews mapRow(ResultSet rs, int i) throws SQLException {
            final int answers = rs.getInt("c");
            final int answers0 = (answers == 0) ? 1 : answers;
            final int tmp = answers0 / perPage;
            final int pages = (answers0 % perPage > 0) ? tmp + 1 : tmp;
            LastMiniNews result = new LastMiniNews(
                    sectionService.getSection(rs.getInt("section")).getSectionLink() + rs.getString("urlname")
                            + '/' + rs.getInt("msgid"),
                    rs.getTimestamp("lastmod"), rs.getString("title"), answers, pages);
            return result;
        }
    });

}

From source file:br.com.asisprojetos.mapper.TBContratoMapper.java

@Override
public TBContrato mapRow(ResultSet rs, int rowNum) throws SQLException {

    TBContrato tbContrato = new TBContrato();
    tbContrato.setCodContrato(rs.getInt("COD_CONTRATO"));
    tbContrato.setCodCliente(rs.getInt("COD_CLIENTE"));
    tbContrato.setCodVendedor(rs.getInt("COD_VENDEDOR"));
    tbContrato.setNumContrato(rs.getString("NUM_CONTRATO"));
    tbContrato.setDataVigenciaIni(rs.getDate("DAT_VIGENCIA_INI"));
    tbContrato.setDataVigenciaFim(rs.getDate("DAT_VIGENCIA_FIM"));
    tbContrato.setComissao(rs.getFloat("COMISSAO"));
    tbContrato.setQtdProcessMes(rs.getInt("QTD_PROCESS_MES"));
    tbContrato.setQtdProcessAtu(rs.getInt("QTD_PROCESS_ATU"));
    tbContrato.setDataUltimaAtu(rs.getDate("DAT_ULTIMA_ATU"));
    tbContrato.setDataCriacao(rs.getDate("DAT_CRIACAO"));
    tbContrato.setQtdCnpj(rs.getInt("QTD_CNPJ"));
    tbContrato.setQtdNF(rs.getInt("QTD_NF"));
    tbContrato.setQtdParcelas(rs.getInt("QTD_PARCELAS"));
    tbContrato.setValor(rs.getFloat("VALOR"));
    tbContrato.setInAtivo(StringUtils.equals(rs.getString("IN_ATIVO"), "A"));
    tbContrato.setFerramenta(rs.getInt("FERRAMENTA"));
    tbContrato.setPrioridade(rs.getInt("PRIORIDADE"));

    return tbContrato;
}