ResultSet getDate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ResultSet getDate method.

This code example shows how to use the following methods:getDate, getInt, getString
	/* (non-Javadoc) 
	 * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet, int) 
	 */	 
	public Person mapRow(ResultSet rs, int rowNum) throws SQLException {
		Person person = new Person();
		person.setPersonId(rs.getInt("id"));
		person.setName(rs.getString("name"));
		person.setGender(Gender.getGenderByIdentifier(rs.getString("gender")));
		person.setDateOfBirth(rs.getDate("dateOfBirth"));
		return person;
	} 
} 
7
CodeRank
This code example shows how to use the following methods:getDate, getInt, getString
 
class JobResultExtractor implements ResultSetExtractor<Job> { 
 
    @Override 
    public Job extractData(ResultSet rs) throws SQLException {
        int id = rs.getInt("id");
        Job job = new Job(id);
        job.setTitle(rs.getString("title"));
        job.setDescription(rs.getString("description"));
        job.setIsland(Island.lookupByChar(rs.getString("island")));
 
        try { 
            job.setUrl(new URL(rs.getString("url")));
        } catch (MalformedURLException e) {
            LoggingComponentFactory.create().warn(this, "Couldn't set URL for " + job.getTitle(), e);
        } 
 
        job.setContentSourceId(rs.getInt("content_source_id"));
        job.setDatePosted(rs.getDate("date_posted"));
 

7
CodeRank
This code example shows how to use the following methods:getBlob, getClob, getDate, getLong, getString
        case Types.NUMERIC:
        case Types.DOUBLE:
        case Types.SMALLINT:
        case Types.TINYINT:
            try { 
                ival = rset.getLong (index);
            } catch (SQLException e) {
                ival = -1;
            } 
            break; 
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.BLOB:
        case Types.CLOB:
            try { 
                if ((type == Types.CHAR) || (type == Types.VARCHAR)) {
                    sval = rset.getString (index);
                } else if (type == Types.BLOB) {
                    Blob    tmp = rset.getBlob (index);
 

6
CodeRank
This code example shows how to use the following methods:getDate, getInt, getString
@SuppressWarnings("rawtypes") 
public class CheckingResultSetExtractor implements ResultSetExtractor { 
	@Override 
	public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
		Checking checking = new Checking();
		checking.setKey(rs.getInt("Key_Checking"));
		checking.setNumberOfCertificate(rs.getString("Number_Certificate_Checking"));
		checking.setComment(rs.getString("Comment_Checking"));
		checking.setDateStartChecking(rs.getDate("Date_Start_Checking"));
		checking.setDateEndChecking(rs.getDate("Date_End_Checking"));
		checking.setNextDateChecking(rs.getDate("Date_Next_Checking"));
		 
		Tool tool = new Tool();
		tool.setKey(rs.getInt("Key_MR"));
		checking.setTool(tool);
		return checking;
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:getBoolean, getDate, getInt, getObject, getString
 * 
 */ 
public class LinkWithTagsRowMapper implements RowMapper<Object[]> {
	private Logger log = Logger.getLogger(getClass());
	public Object[] mapRow(ResultSet rs, int rowNum) throws SQLException {
		Link link = new Link(rs.getInt("id"), rs.getString("address"), rs.getString("name"));
		link.setDateMod(rs.getDate("date_mod"));
		link.setPub(rs.getBoolean("pub"));
		link.setUserId((Integer)rs.getObject("user_id"));
		link.setLdate(rs.getDate("ldate"));
		link.setDescription(rs.getString("description"));
		link.setClicks(rs.getInt("clicks"));
		String tags = rs.getString("tags");
		return new Object[]{link, tags != null ? tags.split(",") : null};
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:getDate, getInt, getString
public class ClientMapper implements RowMapper<Client> { 
 
	@Override 
	public Client mapRow(ResultSet rs, int rowNum) throws SQLException {
		Client client = new Client();
		client.setId(rs.getInt("Client_Id"));
		client.setEmail(rs.getString("Email"));
		client.setAddress(rs.getString("Address"));
		client.setLastName(rs.getString("Last_Name"));
		client.setFirstName(rs.getString("First_Name"));
		client.setPatronymic(rs.getString("Patronymic"));
		client.setBirthday(rs.getDate("Birthdate"));
		client.setPase(rs.getString("Passport_number"));
		client.setPhone(rs.getString("Telephone"));
		client.setSeller(rs.getInt("seller")==1);
		return client;
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:getDate, getInt, getString
public class BattleMapper implements RowMapper<Battle> { 
 
 
	public Battle mapRow(ResultSet rs, int rowNum) throws SQLException {
		Battle battle = new Battle();
		battle.setId(rs.getInt("Id"));
		 
		// Set battlers 
		ShredBattler battler = new ShredBattler( new Shredder(rs.getInt("Shredder1")) );
		ShredBattler battlee = new ShredBattler( new Shredder(rs.getInt("Shredder2")) );		
		battle.setBattler(battler);
		battle.setBattlee(battlee);
	 
		BattleCategori categori = new BattleCategori(rs.getInt("BattleCategori"));
		battle.setBattleCategori(categori);
		 
		battle.setStatus(rs.getString("Status"));
		battle.setTimeCreated(rs.getDate("TimeCreated"));
		battle.setRound(rs.getInt("Round"));
		return battle;

6
CodeRank
This code example shows how to use the following methods:getDate, getString
This code example shows how to use the following methods:getDate, getFloat, getInt, getString
 
public class StockMapper implements RowMapper<Stock> { 
 
    public Stock mapRow(ResultSet rs, int rowNum) throws SQLException {
        Stock stock = new Stock(
                rs.getString("SYMBOL"),
                rs.getString("INVENTORY_CODE"),
                rs.getString("EXCHANGE_ID"),
                rs.getFloat("PRICE_PER_SHARE"),
                rs.getInt("QUANTITY_AVAILABLE"),
                rs.getDate("PURCHASE_DATE")
        ); 
 
        stock.setId(rs.getInt("ID"));
        return stock;
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getBoolean, getDate, getLong, getString
 
  private static class UserRowMapper implements RowMapper<User> { 
    @Override 
    public User mapRow(ResultSet rs, int rowNum) throws SQLException {
      User user = new User();
      user.setId(rs.getLong("id"));
      user.setUsername(rs.getString("username"));
      user.setPassword(rs.getString("password"));
      user.setJoinDate(rs.getDate("join_date"));
      user.setReceiveEmail(rs.getBoolean("receive_email"));
 
      return user;
    } 
  } 
 
  private static class MessageRowMapper implements RowMapper<Message> {
    @Override 
    public Message mapRow(ResultSet rs, int rowNum) throws SQLException {
      Message message = new Message();
      message.setId(rs.getLong("id"));
6
CodeRank

Related ResultSet getDate Questions & Answers:

getDate Method Overview
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.
See Code Examples for other Java 8 ResultSet Methods: