Example usage for org.springframework.data.cassandra.core CassandraOperations selectOne

List of usage examples for org.springframework.data.cassandra.core CassandraOperations selectOne

Introduction

In this page you can find the example usage for org.springframework.data.cassandra.core CassandraOperations selectOne.

Prototype

@Nullable
<T> T selectOne(Query query, Class<T> entityClass) throws DataAccessException;

Source Link

Document

Execute a SELECT query and convert the resulting item to an entity.

Usage

From source file:edu.elka.peakadvisor.model.CassandraDao.java

public Latest readOneWithCurrName(int timestamp, String name) {

    CassandraOperations template = this.cassandraTemplate;
    Latest result = template.selectOne("SELECT timestamp,base,disclaimer,license,rates." + name + " "
            + "FROM latest WHERE timestamp=" + timestamp + ";", Latest.class);
    //tak wiem ze to ma podatnosc, ale jest problem z cudzyslowami przy normalnym chainowaniu
    //chainuje "rates.btc" zamiast rates.btc, nie potrafie tego naprawic
    return result;
}

From source file:edu.elka.peakadvisor.model.CassandraDao.java

public Latest readOne(int timestamp) {

    CassandraOperations template = this.cassandraTemplate;
    Select selectStatement = QueryBuilder.select().from("Latest").allowFiltering();

    selectStatement.where(QueryBuilder.eq("timestamp", timestamp));
    Latest result = template.selectOne(selectStatement, Latest.class);

    return result;
}