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.carfinance.module.vehiclemanage.domain.VehicleInsuranceRowMapper.java
public VehicleInsurance mapRow(ResultSet rs, int arg1) throws SQLException { VehicleInsurance vehicleInfo = new VehicleInsurance(); vehicleInfo.setId(rs.getLong("id")); vehicleInfo.setCarframe_no(rs.getString("carframe_no")); vehicleInfo.setEngine_no(rs.getString("engine_no")); vehicleInfo.setLicense_plate(rs.getString("license_plate")); vehicleInfo.setInsurance_company(rs.getString("insurance_company")); vehicleInfo.setStrong_insurance(rs.getDouble("strong_insurance")); vehicleInfo.setStrong_insurance_expire_at(rs.getDate("strong_insurance_expire_at")); vehicleInfo.setVehicle_vessel_tax(rs.getDouble("vehicle_vessel_tax")); vehicleInfo.setBusiness_insurance(rs.getDouble("business_insurance")); vehicleInfo.setBusiness_insurance_expire_at(rs.getDate("business_insurance_expire_at")); vehicleInfo.setRemark(rs.getString("remark")); vehicleInfo.setCreate_by(rs.getLong("create_by")); vehicleInfo.setCreate_at(rs.getDate("create_at")); vehicleInfo.setCreate_by(rs.getLong("update_by")); vehicleInfo.setCreate_at(rs.getDate("update_at")); return vehicleInfo; }
From source file:dao.SessionManagementDAO.java
public Child getChildFromToken(String token) throws SQLException { try {//from w w w .j ava 2 s . c o m statement = con.prepareStatement("SELECT user_id FROM Tokens WHERE token=?"); statement.setString(1, token); ResultSet result = statement.executeQuery(); while (result.next()) { clean = con.createStatement(); ResultSet results = clean.executeQuery( "SELECT * FROM User INNER JOIN Child On User.user_id=Child.user_id WHERE User.user_id=" + result.getInt("user_id")); while (results.next()) { return new Child(results.getInt("child_id"), results.getDate("date_of_birth"), results.getString("gender"), results.getString("username"), null, "/account/profilepic/" + results.getInt("user_id"), results.getString("name")); } } } catch (Exception e) { log.out(Level.ERROR, "GetChildFromToken", "Can't get user from token"); } finally { try { statement.close(); } catch (Exception e) { log.out(Level.ERROR, "GetChildFromToken", "Can't close the statement"); } try { clean.close(); } catch (Exception e) { log.out(Level.ERROR, "GetChildFromToken", "Can't close the clean"); } } return null; }
From source file:com.microsoftopentechnologies.azchat.web.dao.PreferenceMetadataDAOImpl.java
/** * This method used to set preferenceMetadataEntity object from returned * result set object./* w w w . j a v a 2s. c o m*/ * * @param resutSet * @return * @throws SQLException */ public PreferenceMetadataEntity generateUserObject(ResultSet resutSet) throws SQLException { PreferenceMetadataEntity preferenceMetadataEntity = new PreferenceMetadataEntity(); preferenceMetadataEntity.setPreferenceId(resutSet.getInt(1)); preferenceMetadataEntity.setPreferenceDesc(resutSet.getString(2)); preferenceMetadataEntity.setDateCreated(resutSet.getDate(3)); preferenceMetadataEntity.setCreatedBy(resutSet.getDate(3)); preferenceMetadataEntity.setDateModified(resutSet.getDate(3)); preferenceMetadataEntity.setModifiedBy(resutSet.getDate(3)); return preferenceMetadataEntity; }
From source file:com.havoc.hotel.admin.dao.impl.CustomerDAOImpl.java
private Customer mapData(ResultSet rs) throws SQLException { Customer c = new Customer(); c.setCustomerId(rs.getInt("customer_id")); c.setFirstName(rs.getString("first_name")); c.setLastName(rs.getString("last_name")); c.setEmail(rs.getString("email")); c.setContactNo(rs.getString("contact_no")); c.setUsername(rs.getString("username")); c.setPassword(rs.getString("password")); c.setAddedDate(rs.getDate("added_date")); c.setStatus(rs.getBoolean("status")); return c;//from ww w . ja v a 2s.c o m }
From source file:com.leapfrog.academyspring.dao.impl.EnquiryDAOImpl.java
@Override public List<Enquiry> getAll() { return jdbcTemplate.query(SQLConstants.ENQUIRY_GETALL, new RowMapper<Enquiry>() { @Override/*from w ww . ja v a 2 s. c o m*/ public Enquiry mapRow(ResultSet rs, int i) throws SQLException { Enquiry enq = new Enquiry(); enq.setId(rs.getInt("id")); enq.setFirstName(rs.getString("first_name")); enq.setLastName(rs.getString("last_name")); enq.setEmail(rs.getString("email")); enq.setContactNo(rs.getString("contact_no")); enq.setCourseId(rs.getInt("course_id")); enq.setMessage(rs.getString("message")); enq.setEnquiryDate(rs.getDate("enquiry_date")); enq.setIsRead(rs.getBoolean("is_read")); enq.setParentId(rs.getInt("parent_id")); return enq; } }); }
From source file:de.whs.poodle.repositories.CourseStatisticsRepository.java
public Map<LocalDate, TotalCourseTermStatistics> getDailyStatisticsForCourseTerm(int courseTermId) { return jdbc.query("SELECT * FROM get_daily_course_term_statistics(?)", new Object[] { courseTermId }, new ResultSetExtractor<Map<LocalDate, TotalCourseTermStatistics>>() { @Override/*from w ww. j a va 2 s.c o m*/ public Map<LocalDate, TotalCourseTermStatistics> extractData(ResultSet rs) throws SQLException { Map<LocalDate, TotalCourseTermStatistics> map = new LinkedHashMap<>(); CourseTermStatisticsRowMapper rowMapper = new CourseTermStatisticsRowMapper(); while (rs.next()) { TotalCourseTermStatistics ct = rowMapper.mapRow(rs, 0); LocalDate day = rs.getDate("day").toLocalDate(); map.put(day, ct); } return map; } }); }
From source file:de.whs.poodle.repositories.CourseStatisticsRepository.java
public Map<LocalDate, TotalCourseTermStatistics> getStatisticsForCourse(int courseId) { return jdbc.query("SELECT * FROM get_course_term_statistics(?)", new Object[] { courseId }, new ResultSetExtractor<Map<LocalDate, TotalCourseTermStatistics>>() { @Override// ww w.jav a 2s . co m public Map<LocalDate, TotalCourseTermStatistics> extractData(ResultSet rs) throws SQLException { Map<LocalDate, TotalCourseTermStatistics> map = new LinkedHashMap<>(); CourseTermStatisticsRowMapper rowMapper = new CourseTermStatisticsRowMapper(); while (rs.next()) { TotalCourseTermStatistics ct = rowMapper.mapRow(rs, 0); LocalDate day = rs.getDate("day").toLocalDate(); map.put(day, ct); } return map; } }); }
From source file:com.googlecode.starflow.engine.repository.impl.ProcessInstanceRepositoryImpl.java
public ProcessInstance findProcessInstance(long processInstId) { return this.getJdbcTemplate().queryForObject(findProcessInstanceSQL, new RowMapper<ProcessInstance>() { @Override// w w w.j a v a 2 s .c o m public ProcessInstance mapRow(ResultSet resultSet, int index) throws SQLException { ProcessInstance processInstance = new ProcessInstance(); processInstance.setProcessInstId(resultSet.getLong("processInstId")); processInstance.setProcessDefId(resultSet.getLong("processDefId")); processInstance.setProcessInstName(resultSet.getString("processInstName")); processInstance.setCreator(resultSet.getString("creator")); processInstance.setCreateTime(resultSet.getDate("createTime")); processInstance.setSubFlow(resultSet.getString("subFlow")); processInstance.setLimitNum(resultSet.getLong("limitNum")); processInstance.setCurrentState(resultSet.getInt("currentState")); processInstance.setMainProcInstId(resultSet.getLong("mainProcInstId")); processInstance.setParentProcInstId(resultSet.getLong("parentProcInstId")); processInstance.setActivityInstId(resultSet.getLong("activityInstId")); return processInstance; } }, processInstId); }
From source file:com.microsoftopentechnologies.azchat.web.dao.UserPreferenceDAOImpl.java
/** * This method populates userPreferenceEntity object from input resultSet. * // w w w . jav a 2 s. co m * @param resultSet * @return * @throws SQLException */ public UserPreferenceEntity generateUserObject(ResultSet resultSet) throws SQLException { UserPreferenceEntity userPreferenceEntity = new UserPreferenceEntity(); userPreferenceEntity.setUserPreferenceID(resultSet.getInt(1)); userPreferenceEntity.setUserId(resultSet.getInt(2)); userPreferenceEntity.setPreferenceId(resultSet.getInt(3)); userPreferenceEntity.setDateCreated(resultSet.getDate(4)); userPreferenceEntity.setCreatedBy(resultSet.getDate(5)); userPreferenceEntity.setDateModified(resultSet.getDate(6)); userPreferenceEntity.setModifiedBy(resultSet.getDate(7)); userPreferenceEntity.setPreferenceDesc(resultSet.getString(8)); return userPreferenceEntity; }
From source file:nl.surfnet.coin.shared.log.ApiCallLogServiceImpl.java
@Override public List<ApiCallLog> findApiCallLog(String serviceProvider) { return jdbcTemplate.query( "select user_id, spentity_id, ip_address, api_version, resource_url, consumer_key, log_timestamp from api_call_log where spentity_id = ?", new String[] { serviceProvider }, new RowMapper<ApiCallLog>() { @Override/*from w w w . java 2s. c om*/ public ApiCallLog mapRow(ResultSet rs, int rowNum) throws SQLException { ApiCallLog log = new ApiCallLog(); log.setApiVersion(rs.getString("api_version")); log.setConsumerKey(rs.getString("consumer_key")); log.setIpAddress(rs.getString("ip_address")); log.setResourceUrl(rs.getString("resource_url")); log.setSpEntityId(rs.getString("spentity_id")); log.setTimestamp(rs.getDate("log_timestamp")); log.setUserId(rs.getString("user_id")); return log; } }); }