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:edu.hm.muse.controller.UserMapper.java

@Override
public User mapRow(ResultSet resultSet, int i) throws SQLException {
    User u = new User();
    u.setId(resultSet.getInt("ID"));
    u.setUname(resultSet.getString("muname"));
    u.setUpwd(resultSet.getString("mpwd"));
    return u;/*  w  w w.j a  v a 2 s  .  c o m*/
}

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

public User extractData(ResultSet resultSet) throws SQLException, DataAccessException {
    User user = new User();
    user.setSubCategoryId(resultSet.getInt(1));
    user.setSubCategoryName(resultSet.getString(2));
    user.setSubCategoryNum(resultSet.getInt(3));
    return user;// w ww.j ava 2 s .c om
}

From source file:com.softserveinc.internetbanking.model.mapper.AccountRowMapper.java

@Override
public Account mapRow(ResultSet rs, int rowNum) throws SQLException {
    Account account = new Account();
    account.setAccount_id(rs.getInt("account_id"));
    account.setOwnerName(rs.getString("owner_name"));
    account.setAccountAmount(rs.getBigDecimal("account_amount"));
    account.setStatus(rs.getString("status"));
    account.setUsername(rs.getString("username"));
    return account;
}

From source file:ru.org.linux.user.IgnoreListDao.java

/**
 *  ?? //from   w ww  . ja v a  2  s  .  c  o  m
 * @param user   
 * @return ?? 
 */
@Nonnull
public Set<Integer> get(@Nonnull User user) {
    final Builder<Integer> builder = ImmutableSet.builder();
    jdbcTemplate.query(queryIgnoreList, new RowCallbackHandler() {
        @Override
        public void processRow(ResultSet resultSet) throws SQLException {
            builder.add(resultSet.getInt("ignored"));
        }
    }, user.getId());
    return builder.build();
}

From source file:com.l2jfree.gameserver.model.entity.events.VIP.java

public static void setLoc() {
    Connection con = null;//from   www .ja v  a  2  s . c  om

    try {
        con = L2DatabaseFactory.getInstance().getConnection(con);
        PreparedStatement statement = con.prepareStatement(
                "SELECT endx,endy,endz,startx,starty,startz FROM VIPinfo WHERE teamID = " + _team);
        ResultSet rset = statement.executeQuery();
        rset.next();

        _endX = rset.getInt("endx");
        _endY = rset.getInt("endy");
        _endZ = rset.getInt("endz");
        _startX = rset.getInt("startx");
        _startY = rset.getInt("starty");
        _startZ = rset.getInt("startz");

        rset.close();
        statement.close();
    } catch (SQLException e) {
        _log.error("Could not check End & Start LOC for team" + _team + " got: ", e);
    } finally {
        L2DatabaseFactory.close(con);
    }
}

From source file:com.kang.spring.integration.mapper.PersonMapper.java

public Person mapRow(ResultSet rs, int rowNum) throws SQLException {
    Person person = new Person();
    person.setId(rs.getInt("id"));
    person.setName(rs.getString("name"));
    person.setGender(Gender.getGenderByIdentifier(rs.getString("gender")));
    person.setDateOfBirth(rs.getDate("dateOfBirth"));
    System.out.println(person);/* w ww .  jav a2 s.com*/
    return person;
}

From source file:com.monkeyk.sos.infrastructure.jdbc.UserRowMapper.java

@Override
public User mapRow(ResultSet rs, int i) throws SQLException {
    User user = new User();

    user.id(rs.getInt("id"));
    user.guid(rs.getString("guid"));

    user.archived(rs.getBoolean("archived"));
    user.createTime(rs.getTimestamp("create_time").toLocalDateTime());

    user.email(rs.getString("email"));
    user.phone(rs.getString("phone"));

    user.password(rs.getString("password"));
    user.username(rs.getString("username"));

    user.lastLoginTime(rs.getTimestamp("last_login_time"));

    return user;//from  ww  w.  ja v  a  2s.  com
}

From source file:com.dai.jdbc.PerfilExtractor.java

public Perfil extractData(ResultSet resultSet) throws SQLException, DataAccessException {
    Perfil perfil = new Perfil();
    perfil.setIdPerfil(resultSet.getInt("idPerfil"));
    perfil.setDesignacao(resultSet.getString("designacaoPerfil"));

    return perfil;
}

From source file:springmvc.repository.mappers.MultiResultMapper.java

@Override
public MultiResult mapRow(ResultSet rs, int i) throws SQLException {
    MultiResult multiResult = new MultiResult();
    multiResult.setIdResult(rs.getInt("idresult"));
    multiResult.setScore(rs.getInt("score"));
    multiResult.setEmail(rs.getString("email"));
    multiResult.setIdGame(rs.getInt("idgame"));

    return multiResult;
}

From source file:com.hendisantika.pasien.domain.PasienIdGenerator.java

public Serializable generate(SessionImplementor session, Object object) throws HibernateException {

    String prefix = "PAS-";
    //        String prefix = "1500";
    Connection connection = session.connection();
    try {/*w w  w  .j  a  v a2  s  .  co m*/

        PreparedStatement ps = connection
                .prepareStatement("SELECT MAX(pasien_id) as value from db_pasien.pasien2");

        ResultSet rs = ps.executeQuery();
        if (rs.next()) {
            int id = rs.getInt("value") + 1;
            //                String id = rs.getString("value") + 1;
            String code = prefix + new Integer(id);
            //                String code = prefix + id;

            //                String code = prefix + StringUtils.leftPad("" + id, 3, '0');
            System.out.println("Generated pasienId: " + code);
            return code;
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return null;
}