Package org.springframework.data.cassandra.repository.query

Examples of org.springframework.data.cassandra.repository.query.StringBasedCassandraQuery


  @Test
  public void bindsSimplePropertyCorrectly() throws Exception {

    Method method = SampleRepository.class.getMethod("findByLastname", String.class);
    CassandraQueryMethod queryMethod = new CassandraQueryMethod(method, metadata, converter.getMappingContext());
    StringBasedCassandraQuery cassandraQuery = new StringBasedCassandraQuery(queryMethod, operations);
    CassandraParametersParameterAccessor accesor = new CassandraParametersParameterAccessor(queryMethod, "Matthews");

    String stringQuery = cassandraQuery.createQuery(accesor);
    SimpleStatement actual = new SimpleStatement(stringQuery);

    String table = Person.class.getSimpleName().toLowerCase();
    Select expected = QueryBuilder.select().all().from(table);
    expected.setForceNoValues(true);
View Full Code Here


  @Test
  public void bindsMultipleParametersCorrectly() throws Exception {

    Method method = SampleRepository.class.getMethod("findByLastnameAndFirstname", String.class, String.class);
    CassandraQueryMethod queryMethod = new CassandraQueryMethod(method, metadata, converter.getMappingContext());
    StringBasedCassandraQuery cassandraQuery = new StringBasedCassandraQuery(queryMethod, operations);
    CassandraParametersParameterAccessor accesor = new CassandraParametersParameterAccessor(queryMethod, "Matthews",
        "John");

    String stringQuery = cassandraQuery.createQuery(accesor);
    SimpleStatement actual = new SimpleStatement(stringQuery);

    String table = Person.class.getSimpleName().toLowerCase();
    Select expected = QueryBuilder.select().all().from(table);
    expected.setForceNoValues(true);
View Full Code Here

      CassandraQueryMethod queryMethod = new CassandraQueryMethod(method, metadata, mappingContext);
      String namedQueryName = queryMethod.getNamedQueryName();

      if (namedQueries.hasQuery(namedQueryName)) {
        String namedQuery = namedQueries.getQuery(namedQueryName);
        return new StringBasedCassandraQuery(namedQuery, queryMethod, cassandraTemplate);
      } else if (queryMethod.hasAnnotatedQuery()) {
        return new StringBasedCassandraQuery(queryMethod, cassandraTemplate);
      } else {
        throw new InvalidDataAccessApiUsageException("declarative query methods are a todo");
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.cassandra.repository.query.StringBasedCassandraQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.