Skip to content

Instantly share code, notes, and snippets.

@zznate
Created February 28, 2012 18:53
Show Gist options
  • Save zznate/1934361 to your computer and use it in GitHub Desktop.
Save zznate/1934361 to your computer and use it in GitHub Desktop.
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