Created
February 28, 2012 18:53
-
-
Save zznate/1934361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String STOCK_CQL = "select price FROM Stocks WHERE KEY = ?"; | |
public Stock load(String stockTicker) { | |
jdbcTemplate.query(STOCK_CQL, stockTicker, | |
new RowMapper<Stock>() { | |
public Stock mapRow(ResultSet rs, int row) throws SQLException { | |
CassandraResultSet crs = (CassandraResultSet)rs; | |
Stock stock = new Stock(); | |
stock.setTicker(new String(crs.getKey())); | |
stock.setPrice(crs.getDouble("price")); | |
return stock; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment