Example usage for java.sql ResultSet getDate

List of usage examples for java.sql ResultSet getDate

Introduction

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

Prototype

java.sql.Date getDate(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.

Usage

From source file:com.mvdb.etl.model.OrderRowMapper.java

public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
    Order order = new Order();
    order.setOrderId(rs.getLong("ORDER_ID"));
    order.setNote(rs.getString("NOTE"));
    order.setSaleCode(rs.getInt("SALE_CODE"));
    order.setCreateTime(new java.util.Date(rs.getDate("CREATE_TIME").getTime()));
    order.setUpdateTime(new java.util.Date(rs.getDate("UPDATE_TIME").getTime()));
    return order;
}

From source file:org.sakaiproject.tool.tasklist.impl.TaskRowMapper.java

public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
    Task task = new TaskImpl();
    task.setId(new Long(rs.getLong(TASK_ID)));
    task.setOwner(rs.getString(TASK_OWNER));
    task.setSiteId(rs.getString(TASK_SITE_ID));
    task.setCreationDate(rs.getDate(TASK_CREATION_DATE));
    task.setTask(rs.getString(TASK_TEXT));
    return task;//from   ww  w  .  j  a v  a2s.com
}

From source file:com.home.ln_spring.ch8.dao.jdbc.annotation.SelectAllContacts.java

@Override
protected Contact mapRow(ResultSet rs, int i) throws SQLException {
    Contact contact = new Contact();

    contact.setId(rs.getInt("contact_id"));
    contact.setFirstName(rs.getString("first_name"));
    contact.setLastName(rs.getString("last_name"));
    contact.setBirthDate(rs.getDate("birth_date"));

    return contact;
}

From source file:com.ewcms.content.particular.dao.FrontEmployeArticleDAO.java

private EmployeArticle interactionRowMapper(ResultSet rs) throws SQLException {
    EmployeArticle vo = new EmployeArticle();
    vo.setId(rs.getLong("id"));
    vo.setDense(Dense.valueOf(rs.getString("dense")));
    vo.setPublished(rs.getDate("published"));
    vo.setEmployeBasic(frontEmployeBasicDAO.get(rs.getLong("employebasic_cardcode")));
    return vo;//www  .j a v a 2s  . c o m
}

From source file:com.ewcms.content.particular.dao.FrontEnterpriseArticleDAO.java

private EnterpriseArticle interactionRowMapper(ResultSet rs) throws SQLException {
    EnterpriseArticle vo = new EnterpriseArticle();
    vo.setId(rs.getLong("id"));
    vo.setDense(Dense.valueOf(rs.getString("dense")));
    vo.setPublished(rs.getDate("published"));
    vo.setEnterpriseBasic(frontEnterpriseBasicDAO.get(rs.getLong("enterprisebasic_yyzzzch")));
    return vo;/*w w  w.j  av a2 s  . c o  m*/
}

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);//from  w  w  w.j  ava2  s .  co  m
    return person;
}

From source file:com.nabla.dc.server.handler.fixed_asset.UpdateAssetDisposalHandler.java

private Date getAssetAcqisitionDate(final Connection conn, int assetId) throws SQLException, ActionException {
    final PreparedStatement stmt = StatementFormat.prepare(conn,
            "SELECT acquisition_date FROM fa_asset WHERE id=?;", assetId);
    try {// ww w.j a va2 s.c o m
        final ResultSet rs = stmt.executeQuery();
        try {
            if (!rs.next())
                throw new ActionException(CommonServerErrors.RECORD_HAS_BEEN_REMOVED);
            return rs.getDate(1);
        } finally {
            rs.close();
        }
    } finally {
        stmt.close();
    }
}

From source file:mx.edu.um.portlets.esu.dao.impl.DiaDaoImpl.java

@Override
public Dia mapRow(ResultSet rs, int i) throws SQLException {
    Dia dia = new Dia();
    dia.setId(rs.getLong("id"));
    dia.setVersion(rs.getInt("version"));
    dia.setFecha(rs.getDate("fecha"));
    dia.setLeccion(rs.getLong("leccion"));
    dia.setLeccionAsset(rs.getLong("leccionAsset"));
    dia.setVersiculo(rs.getLong("versiculo"));
    dia.setVersiculoAsset(rs.getLong("versiculoAsset"));
    dia.setVideo(rs.getLong("video"));
    dia.setDialoga1(rs.getLong("dialoga1"));
    dia.setDialoga2(rs.getLong("dialoga2"));
    dia.setDialoga3(rs.getLong("dialoga3"));
    dia.setDialoga4(rs.getLong("dialoga4"));
    dia.setComunica1(rs.getLong("comunica1"));
    dia.setComunica2(rs.getLong("comunica2"));
    dia.setComunica3(rs.getLong("comunica3"));
    dia.setComunica4(rs.getLong("comunica4"));
    dia.setPodcastSemanal(rs.getLong("podcastsemanal"));
    dia.setPodcastDiario(rs.getLong("podcastdiario"));
    return dia;/*w ww  .j  a va  2  s  .  com*/
}

From source file:org.apache.phoenix.util.TestUtil.java

public static void validateRowKeyColumns(ResultSet rs, int i) throws SQLException {
    assertTrue(rs.next());//from  w ww  . ja va  2  s.  co  m
    assertEquals(rs.getString(1), "varchar" + String.valueOf(i));
    assertEquals(rs.getString(2), "char" + String.valueOf(i));
    assertEquals(rs.getInt(3), i);
    assertEquals(rs.getInt(4), i);
    assertEquals(rs.getBigDecimal(5), new BigDecimal(i * 0.5d));
    Date date = new Date(DateUtil.parseDate("2015-01-01 00:00:00").getTime() + (i - 1) * MILLIS_IN_DAY);
    assertEquals(rs.getDate(6), date);
}

From source file:database.EWPMapper.java

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

    ExerciseWithParticipants ewp = new ExerciseWithParticipants();

    ewp.setHours(rs.getFloat("exercise.hours"));
    ewp.setFirstname(rs.getString("users.firstname"));
    ewp.setLastname(rs.getString("users.lastname"));
    ewp.setDate(rs.getDate("exercise.date"));
    return ewp;/*w  w  w  .j av a 2 s . com*/

}