List of usage examples for java.sql ResultSet getDate
java.sql.Date getDate(String columnLabel) throws SQLException;
ResultSet
object as a java.sql.Date
object in the Java programming language. From source file:com.havoc.hotel.admin.dao.impl.CheckoutDAOImpl.java
private Checkout mapData(ResultSet rs) throws SQLException { Checkout checkout = new Checkout(); checkout.setCheckoutId(rs.getInt("checkout_id")); Checkin c = new Checkin(); c.setCheckinId(rs.getInt("checkin_id")); Booking b = new Booking(); b.setFirstName(rs.getString("first_name")); b.setLastName(rs.getString("last_name")); b.setCheckinDate(rs.getDate("checkin_date")); b.setCheckoutDate(rs.getDate("checkout_date")); b.setTotalDays(rs.getInt("total_days")); b.setTotalNights(rs.getInt("total_nights")); b.setTotalPrice(rs.getInt("total_price")); Room r = new Room(); r.setRoomNumber(rs.getInt("room_number")); r.setRoomPrice(rs.getInt("room_price")); c.setBooking(b);/* w ww . j a va 2 s . c o m*/ checkout.setCheckin(c); return checkout; }
From source file:com.ewcms.component.online.dao.AdvisorDAO.java
public List<Advisor> findAdvisorByMatter(final Integer matterId, String title, final int limit) { String sql = "Select * From plugin_online_advisory " + "Where matter_id = ? And title Like ? And checked = true " + "Order By date Desc"; title = (title == null || title.trim().length() == 0) ? "%" : "%" + title + "%"; return jdbcTemplate.query(sql, new Object[] { matterId, title }, new RowMapper<Advisor>() { @Override// w w w . j av a2s.c o m public Advisor mapRow(ResultSet rs, int rowNum) throws SQLException { Advisor advisor = new Advisor(); advisor.setId(rs.getInt("id")); advisor.setTitle(rs.getString("title")); advisor.setName(rs.getString("name")); advisor.setState(rs.getInt("state")); advisor.setDate(rs.getDate("date")); return advisor; } }); }
From source file:nl.ordina.bag.etl.dao.AbstractBAGMutatiesDAO.java
@Override public MutatiesFile getNexMutatiesFile() throws DAOException { try {// www. jav a 2 s.c o m MutatiesFile file = jdbcTemplate.queryForObject( "select *" + " from bag_mutaties_file" + " where date_from = (select (max(date_to)) from bag_mutaties_file where status = " + ProcessingStatus.PROCESSED.ordinal() + ")", // + //" union all" + //" select *" + //" from bag_mutaties_file" + //" where date_from = (select (min(date_from)) from bag_mutaties_file where status = " + ProcessingStatus.UNPROCESSED.ordinal() + //" and (select count(id) from bag_mutaties_file where status = " + ProcessingStatus.PROCESSED.ordinal() + ") = 0)", new RowMapper<MutatiesFile>() { @Override public MutatiesFile mapRow(ResultSet rs, int row) throws SQLException { MutatiesFile object = new MutatiesFile(); object.setId(rs.getLong("id")); object.setDateFrom(rs.getDate("date_from")); object.setDateTo(rs.getDate("date_to")); object.setContent(rs.getBytes("content")); object.setStatus(ProcessingStatus.values()[rs.getInt("status")]); return object; } }); return file; } catch (IncorrectResultSizeDataAccessException e) { return null; } catch (DataAccessException e) { throw new DAOException(e); } }
From source file:com.abixen.platform.service.businessintelligence.multivisualisation.service.impl.AbstractDatabaseService.java
private DataValueWeb getValueAsDataSourceValueDateWeb(ResultSet row, String columnName) throws SQLException { Date value = row.getDate(row.findColumn(columnName)); return new DataValueDateWeb() { @Override/*from w w w . j av a 2 s . c om*/ public Date getValue() { return value; } @Override public void setValue(Date value) { throw new NotImplementedException("Setter not implemented yet"); } }; }
From source file:mx.edu.um.escuela.dao.MaestroDaoJdbc.java
@Override public Maestro mapRow(ResultSet rs, int i) throws SQLException { Maestro maestro = new Maestro(); maestro.setId(rs.getLong("id")); maestro.setNomina(rs.getString("nomina")); maestro.setNombre(rs.getString("nombre")); maestro.setApellido(rs.getString("apellido")); if (rs.getDate("fecha_nacimiento") != null) { maestro.setFechaNacimiento(new Date(rs.getDate("fecha_nacimiento").getTime())); }/*from w ww . java2 s. c om*/ maestro.setEsHombre(rs.getBoolean("es_hombre")); if (rs.getString("correo") != null) { maestro.setCorreo(rs.getString("correo")); } return maestro; }
From source file:org.psystems.dicom.browser.server.stat.StatClientRequestsChartServlet2.java
/** * @param connection/*from w w w . jav a 2 s. c om*/ * @param series * @param metrica * @param timeBegin * @param timeEnd * @param dataset * @throws SQLException */ private void getMetrics(Connection connection, String series, String metrica, Calendar calendarBegin, Calendar calendarEnd, DefaultCategoryDataset dataset) throws SQLException { PreparedStatement stmt = null; try { SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy"); Calendar calendar1 = (Calendar) calendarBegin.clone(); String dateStr = format.format(calendar1.getTime()); dataset.addValue(0, series, dateStr); for (int i = 0; i < 6; i++) { calendar1.add(Calendar.DAY_OF_MONTH, 1); dateStr = format.format(calendar1.getTime()); dataset.addValue(0, series, dateStr); } stmt = connection.prepareStatement("SELECT METRIC_VALUE_LONG, METRIC_DATE" + " FROM WEBDICOM.DAYSTAT WHERE METRIC_NAME = ? and " + " METRIC_DATE BETWEEN ? AND ? "); stmt.setString(1, metrica); stmt.setDate(2, new java.sql.Date(calendarBegin.getTimeInMillis())); stmt.setDate(3, new java.sql.Date(calendarEnd.getTimeInMillis())); ResultSet rs = stmt.executeQuery(); while (rs.next()) { long value = rs.getLong("METRIC_VALUE_LONG"); Date date = rs.getDate("METRIC_DATE"); dateStr = format.format(date.getTime()); String category = dateStr; dataset.addValue(value, series, category); // System.out.println(value + " = " + series + " = "+ category); } rs.close(); } finally { if (stmt != null) stmt.close(); } }
From source file:org.psystems.dicom.browser.server.stat.StatDailyLoadChartServlet2.java
/** * @param connection/*w w w.java 2s. co m*/ * @param series * @param metrica * @param timeBegin * @param timeEnd * @param dataset * @throws SQLException */ private void getMetrics(Connection connection, String series, String metrica, Calendar calendarBegin, Calendar calendarEnd, DefaultCategoryDataset dataset) throws SQLException { PreparedStatement stmt = null; try { SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy"); Calendar calendar1 = (Calendar) calendarBegin.clone(); String dateStr = format.format(calendar1.getTime()); dataset.addValue(0, series, dateStr); for (int i = 0; i < 6; i++) { calendar1.add(Calendar.DAY_OF_MONTH, 1); dateStr = format.format(calendar1.getTime()); dataset.addValue(0, series, dateStr); } stmt = connection.prepareStatement("SELECT METRIC_VALUE_LONG, METRIC_DATE" + " FROM WEBDICOM.DAYSTAT WHERE METRIC_NAME = ? and " + " METRIC_DATE BETWEEN ? AND ? "); stmt.setString(1, metrica); stmt.setDate(2, new java.sql.Date(calendarBegin.getTimeInMillis())); stmt.setDate(3, new java.sql.Date(calendarEnd.getTimeInMillis())); ResultSet rs = stmt.executeQuery(); while (rs.next()) { long value = rs.getLong("METRIC_VALUE_LONG") / 1000; Date date = rs.getDate("METRIC_DATE"); dateStr = format.format(date.getTime()); String category = dateStr; dataset.addValue(value, series, category); // System.out.println(value + " = " + series + " = "+ category); } rs.close(); } finally { if (stmt != null) stmt.close(); } }
From source file:edu.clemson.cs.nestbed.server.adaptation.sql.ProgramProfilingMessageSymbolSqlAdapter.java
private final ProgramProfilingMessageSymbol getProfilingMessageSymbol(ResultSet resultSet) throws SQLException { int id = resultSet.getInt(Index.ID.index()); int pdConfId = resultSet.getInt(Index.PDCONFID.index()); int progMsgSymID = resultSet.getInt(Index.PROGMSGSYMID.index()); Date timestamp = resultSet.getDate(Index.TIMESTAMP.index()); return new ProgramProfilingMessageSymbol(id, pdConfId, progMsgSymID, timestamp); }
From source file:com.lanacion.adminsiteln.dao.infografiasrepository.InfografiaMapper.java
public InfografiaDocument mapRow(ResultSet rs, int rowNum) throws SQLException { InfografiaDocument infografia = new InfografiaDocument(); infografia.setIdInfografia(rs.getInt("idInfografia")); infografia.setTitulo(rs.getString("titulo")); infografia.setDescripcion(rs.getString("descripcion")); infografia.setEstado(rs.getInt("estado")); infografia.setTipo_infografia(rs.getInt("tipo_infografia")); infografia.setFecha_creacion(rs.getDate("fecha_creacion")); infografia.setFecha_modificacion(rs.getDate("fecha_modificacion")); return infografia; }
From source file:com.leapfrog.academyspring.dao.impl.CourseDAOImpl.java
private Course mapData(ResultSet rs) throws SQLException { Course cor = new Course(); cor.setId(rs.getInt("id")); cor.setName(rs.getString("name")); cor.setDescription(rs.getString("description")); cor.setCourseDuration(rs.getInt("course_duration")); cor.setDurationType(rs.getString("duration_type")); cor.setFees(rs.getDouble("fees")); cor.setAddedDate(rs.getDate("added_date")); cor.setModifiedDate(rs.getDate("modified_date")); cor.setDeleteFlag(rs.getBoolean("delete_flag")); cor.setDeleteDate(rs.getDate("delete_date")); cor.setStatus(rs.getBoolean("status")); return cor;//from w w w .j a va 2 s .c om }