List of usage examples for java.sql ResultSet getLong
long getLong(String columnLabel) throws SQLException;
ResultSet
object as a long
in the Java programming language. From source file:com.grayfox.server.dao.jdbc.CategoryJdbcDao.java
@Override public List<Category> findByPartialName(String partialName, Locale locale) { String query = String.format(getQuery("Category.findByPartialName", locale), partialName); return getJdbcTemplate().query(query, (ResultSet rs, int i) -> { Category category = new Category(); int columnIndex = 1; category.setId(rs.getLong(columnIndex++)); category.setName(rs.getString(columnIndex++)); category.setIconUrl(rs.getString(columnIndex++)); category.setFoursquareId(rs.getString(columnIndex++)); return category; });/*www .j ava 2s . c o m*/ }
From source file:net.bhira.sample.api.jdbc.EmployeeRowMapper.java
/** * Constructor for EmployeeRowMapper that creates an instance of * {@link net.bhira.sample.model.Employee} from row represented by rowNum in the given * ResultSet./*from w w w . jav a 2 s .c o m*/ * * @param rs * an instance of ResultSet to be processed. * @param rowNum * integer representing the row number in ResultSet. */ @Override public Employee mapRow(ResultSet rs, int rowNum) throws SQLException { Employee employee = new Employee(); employee.setId(rs.getLong("id")); employee.setCompanyId(rs.getLong("companyid")); employee.setDepartmentId(rs.getLong("departmentid")); employee.setName(rs.getString("name")); employee.setManagerId(rs.getLong("managerid")); employee.setSalutation(rs.getString("salutation")); employee.setDOB(rs.getDate("dob")); employee.setTitle(rs.getString("title")); String sex = rs.getString("sex"); if (sex != null) { employee.setSex(Employee.Sex.valueOf(sex)); } employee.setAddress(rs.getString("addr")); employee.setCreated(rs.getTimestamp("created")); employee.setModified(rs.getTimestamp("modified")); employee.setCreatedBy(rs.getString("createdby")); employee.setModifiedBy(rs.getString("modifiedby")); return employee; }
From source file:com.github.binarywang.demo.spring.dao.AppointmentDao.java
public long count() { return jdbcTemplate.queryForObject("select count(id) from appointment", new RowMapper<Long>() { @Override/*from w w w .j a v a 2s . c o m*/ public Long mapRow(ResultSet resultSet, int i) throws SQLException { return resultSet.getLong(1); } }); }
From source file:zerogame.info.javapay.dao.UserDao.java
@Override public Player mapRow(ResultSet rs, int i) throws SQLException { Player user = new Player(); user.setUin(rs.getLong("uin")); user.setVip(rs.getInt("vip")); user.setLevel(rs.getInt("level")); return user;/*from w w w .j a v a2s. c o m*/ }
From source file:org.inbio.ait.jdbc.mapper.IndiMapper.java
@Override public Indicator mapRow(ResultSet rs, int rowNum) throws SQLException { Indicator i = new Indicator(); //Mandatory data i.setIndicator_id(rs.getLong(ph.getIndicator_id())); i.setIndicator_name(rs.getString(ph.getIndicator_name())); //Aditional data if (!ph.getIndicator_description().equals("unmapped")) { i.setIndicator_description(rs.getString(ph.getIndicator_description())); }//from w w w .j a va 2 s . c om if (!ph.getIndicator_applies_to_part().equals("unmapped")) { i.setIndicator_applies_to_part(rs.getLong(ph.getIndicator_applies_to_part())); } if (!ph.getIndicator_ancestor_id().equals("unmapped")) { i.setIndicator_ancestor_id(rs.getLong(ph.getIndicator_ancestor_id())); } if (!ph.getIndicator_references().equals("unmapped")) { i.setIndicator_references(rs.getString(ph.getIndicator_references())); } return i; }
From source file:org.jasig.schedassist.impl.owner.PersistenceAvailableBlockRowMapper.java
public PersistenceAvailableBlock mapRow(ResultSet rs, int rowNum) throws SQLException { PersistenceAvailableBlock schedule = new PersistenceAvailableBlock(); schedule.setOwnerId(rs.getLong("owner_id")); schedule.setStartTime(rs.getTimestamp("start_time")); schedule.setEndTime(rs.getTimestamp("end_time")); int visitorLimit = rs.getInt("visitor_limit"); if (visitorLimit == 0) { // visitor_limit column empty (undefined), set default (1) visitorLimit = 1;//from ww w. ja va 2s . co m } schedule.setVisitorLimit(visitorLimit); schedule.setMeetingLocation(rs.getString("meeting_location")); return schedule; }
From source file:uta.ak.usttmp.common.dao.mapper.MiningTaskRowMapper.java
@Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException { try {/*from ww w . j a v a2s . c o m*/ MiningTask mt = new MiningTask(); mt.setId(rs.getLong("mme_eid")); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); mt.setStartTime(formatter.parse(rs.getString("starttime"))); mt.setEndTime(formatter.parse(rs.getString("endtime"))); mt.setKeywordNum(rs.getInt("keyword_num")); mt.setMiningInterval(rs.getInt("mininginterval")); mt.setName(rs.getString("name")); mt.setStatus(rs.getInt("status")); mt.setTag(rs.getString("tag")); mt.setTopicNum(rs.getInt("topic_num")); mt.setQrtzJobName(rs.getString("qrtz_job_name")); mt.setQrtzJobExecCount(rs.getInt("qrtz_job_exec_count")); mt.setQrtzJobTotalCount(rs.getInt("qrtz_job_total_count")); mt.setPreprocessComponent(rs.getString("preprocess_component")); mt.setMiningComponent(rs.getString("mining_component")); mt.setTrackingComponent(rs.getString("tracking_component")); mt.setAlpha(rs.getDouble("alpha")); mt.setBeta(rs.getDouble("beta")); return mt; } catch (ParseException ex) { Logger.getLogger(MiningTaskRowMapper.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:net.sf.l2j.gameserver.model.entity.ClanHallSiege.java
public long restoreSiegeDate(int ClanHallId) { long res = 0; Connection con = null;/*from www . j a va 2 s . co m*/ try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT siege_data FROM clanhall_siege WHERE id=?"); statement.setInt(1, ClanHallId); ResultSet rs = statement.executeQuery(); if (rs.next()) res = rs.getLong("siege_data"); rs.close(); statement.close(); } catch (Exception e) { _log.error("Exception: can't get clanhall siege date: " + e.getMessage(), e); } finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } } return res; }
From source file:org.tibetjungle.demo.dao.ContactDaoImpl.java
private Contact mapContact(ResultSet rs) throws SQLException { Contact contact = new Contact(); contact.setId(new Long(rs.getLong("id"))); contact.setName(rs.getString("contact_name")); contact.setEmail(rs.getString("email")); 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;//from w w w . j av a 2 s . c o m }