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:ru.mystamps.web.dao.impl.SeriesInfoDtoRowMapper.java

@Override
public SeriesInfoDto mapRow(ResultSet resultSet, int i) throws SQLException {
    Integer seriesId = resultSet.getInt("id");
    Integer releaseDay = JdbcUtils.getInteger(resultSet, "release_day");
    Integer releaseMonth = JdbcUtils.getInteger(resultSet, "release_month");
    Integer releaseYear = JdbcUtils.getInteger(resultSet, "release_year");
    Integer quantity = resultSet.getInt("quantity");
    Boolean perforated = resultSet.getBoolean("perforated");
    Integer categoryId = resultSet.getInt("category_id");
    String categorySlug = resultSet.getString("category_slug");
    String categoryName = resultSet.getString("category_name");
    Integer countryId = JdbcUtils.getInteger(resultSet, "country_id");
    String countrySlug = resultSet.getString("country_slug");
    String countryName = resultSet.getString("country_name");

    return new SeriesInfoDto(seriesId, categoryId, categorySlug, categoryName, countryId, countrySlug,
            countryName, releaseDay, releaseMonth, releaseYear, quantity, perforated);
}

From source file:entity.ProdukMapper.java

@Override
public Produk mapRow(ResultSet rs, int i) throws SQLException {
    Produk temp = new Produk();
    temp.setId(rs.getInt("id"));
    temp.setKode(rs.getString("kode"));
    temp.setNama(rs.getString("nama"));
    temp.setHarga(rs.getDouble("harga"));
    temp.setKategori(this.kategoriDAO.getById(rs.getInt("id_kategori")));
    return temp;//from   ww  w .ja va  2s. c o  m
}

From source file:com.wso2telco.proxy.util.DBUtils.java

/**
 * Get operators' MSISDN header properties.
 *
 * @return operators' MSISDN header properties map.
 * @throws SQLException    on errors/*www  .j  av  a  2 s  . co  m*/
 * @throws NamingException on errors
 */
public static Map<String, List<MSISDNHeader>> getOperatorsMSISDNHeaderProperties()
        throws SQLException, NamingException {
    Connection connection = null;
    PreparedStatement preparedStatement = null;
    ResultSet resultSet = null;
    Map<String, List<MSISDNHeader>> operatorsMSISDNHeadersList = new HashMap<String, List<MSISDNHeader>>();
    String queryToGetOperatorProperty = "SELECT DISTINCT operatorId, LOWER(operatorName) AS operatorName FROM "
            + "operators_msisdn_headers_properties prop LEFT JOIN operators op ON op.ID=prop.operatorId";
    try {
        connection = getConnectDBConnection();
        preparedStatement = connection.prepareStatement(queryToGetOperatorProperty);
        resultSet = preparedStatement.executeQuery();
        while (resultSet.next()) {
            int operatorId = resultSet.getInt(AuthProxyConstants.OPERATOR_ID);
            String operatorName = resultSet.getString(AuthProxyConstants.OPERATOR_NAME);
            //Get msisdn properties of the operator.
            List<MSISDNHeader> msisdnHeaderList = getMSISDNPropertiesByOperatorId(operatorId, operatorName);
            operatorsMSISDNHeadersList.put(operatorName, msisdnHeaderList);
        }
    } catch (SQLException e) {
        throw new SQLException("Error occurred while retrieving operator MSISDN properties of operators : ", e);
    } catch (NamingException e) {
        throw new ConfigurationException("DataSource could not be found in mobile-connect.xml");
    } finally {
        closeAllConnections(preparedStatement, connection, resultSet);
    }
    return operatorsMSISDNHeadersList;
}

From source file:com.logAnything.tvShows.TVShowRowMapper.java

@Override
public TVShow mapRow(ResultSet rs, int i) throws SQLException {
    TVShow tvShow = new TVShow();
    tvShow.setId(rs.getInt("id"));
    tvShow.setTitle(rs.getString("title"));
    tvShow.setDayOfWeek(rs.getString("dayOfWeek"));
    tvShow.setDownloadDate(formatDate(rs.getDate("downloadDate")));
    tvShow.setLatestEpisode(rs.getInt("latestEpisode"));
    return tvShow;
}

From source file:org.smigo.species.JdbcFamilyDao.java

@Override
public List<Family> getFamilies() {
    final String sql = String.format(SELECT);
    return jdbcTemplate.query(sql, new RowMapper<Family>() {
        @Override//  w w  w  .j  a  v a2 s. com
        public Family mapRow(ResultSet rs, int rowNum) throws SQLException {
            return new Family(rs.getInt("id"), rs.getString("name"));
        }
    });
}

From source file:BBDDMapper.ProductoMapper.java

@Override
public Object mapRow(ResultSet rs, int i) throws SQLException {
    Producto p = new Producto();
    p.setIdRestaurante(rs.getInt("idRestaurante"));
    p.setIdProducto(rs.getInt("idProducto"));
    p.setNombre(rs.getString("nombreProducto"));
    p.setDescripcion(rs.getString("descripcion"));
    p.setIdTipoProducto(rs.getInt("idTipoProducto"));
    p.setTipoProducto(rs.getString("nombreTipoProducto"));
    return p;//  ww  w . j  av  a 2 s .co  m
}

From source file:database.ExerciseMapper.java

@Override
public Exercise mapRow(ResultSet rs, int rowNum) throws SQLException {
    Exercise exercise = new Exercise();
    exercise.setId(rs.getInt("id"));
    exercise.setDate(rs.getDate("date"));
    exercise.setHours(rs.getFloat("hours"));
    exercise.setUserid(rs.getInt("userid"));
    return exercise;
}

From source file:com.google.enterprise.connector.sharepoint.dao.UserGroupMembershipRowMapper.java

public UserGroupMembership mapRow(ResultSet result, int rowNum) throws SQLException {
    return new UserGroupMembership(result.getInt(userID), result.getString(userName), result.getInt(groupID),
            result.getString(groupName), result.getString(namespace));
}

From source file:com.pet.demo.repository.jdbc.JdbcPetRowMapper.java

public JdbcPet mapRow(ResultSet rs, int rownum) throws SQLException {
    JdbcPet pet = new JdbcPet();
    pet.setId(rs.getInt("id"));
    pet.setName(rs.getString("name"));
    Date birthDate = rs.getDate("birth_date");
    pet.setBirthDate(new DateTime(birthDate));
    pet.setTypeId(rs.getInt("type_id"));
    pet.setOwnerId(rs.getInt("owner_id"));
    return pet;// w  ww .j  a v  a 2  s.  com
}

From source file:org.satic.persistence.pojo.DAO.rowMapper.ContenidoRowMapper.java

@Override
public Contenido mapRow(ResultSet rs, int i) throws SQLException {
    Contenido c = new Contenido();
    c.setIdContenido(rs.getInt("id_contenido"));
    c.setTipoContenido(rs.getString("tipo_contenido"));
    c.setCategoria(rs.getString("categoria"));
    c.setRuta(rs.getString("ruta"));
    c.setDescripcion(rs.getString("descripcion"));
    c.setTitulo(rs.getString("titulo"));
    return c;/*w  w  w.ja va 2 s . c o  m*/
}