Package com.datastax.driver.core.querybuilder

Examples of com.datastax.driver.core.querybuilder.Select.where()


            case GET:
                {
                    Select select = table == null
                                  ? select().all().from(mapper.getKeyspace(), mapper.getTable())
                                  : select().all().from(table);
                    Select.Where where = select.where();
                    for (int i = 0; i < mapper.primaryKeySize(); i++)
                        where.and(eq(mapper.getPrimaryKeyColumn(i).getColumnName(), bindMarker()));
                    return select.toString();
                }
            case DEL:
View Full Code Here


            case REVERSED_SLICE:
                {
                    Select select = table == null
                                  ? select().all().from(mapper.getKeyspace(), mapper.getTable())
                                  : select().all().from(table);
                    Select.Where where = select.where();
                    for (int i = 0; i < mapper.partitionKeys.size(); i++)
                        where.and(eq(mapper.partitionKeys.get(i).getColumnName(), bindMarker()));

                    if (startBoundSize > 0) {
                        if (startBoundSize == 1) {
View Full Code Here

  public void test() {
    t.insert(c1);
    t.insert(c2);

    Select select = QueryBuilder.select().from("identity_correlations");
    select.where(QueryBuilder.eq("type", "a")).and(QueryBuilder.eq("value", "b"));
    select.setRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE);
    select.setConsistencyLevel(ConsistencyLevel.ONE);
    List<CorrelationEntity> correlationEntities = t.select(select, CorrelationEntity.class);

    assertEquals(2, correlationEntities.size());
View Full Code Here

    SimpleStatement actual = new SimpleStatement(stringQuery);

    String table = Person.class.getSimpleName().toLowerCase();
    Select expected = QueryBuilder.select().all().from(table);
    expected.setForceNoValues(true);
    expected.where(QueryBuilder.eq("lastname", "Matthews"));

    assertThat(actual.getQueryString(), is(expected.getQueryString()));
  }

  @Test
View Full Code Here

    SimpleStatement actual = new SimpleStatement(stringQuery);

    String table = Person.class.getSimpleName().toLowerCase();
    Select expected = QueryBuilder.select().all().from(table);
    expected.setForceNoValues(true);
    expected.where(QueryBuilder.eq("lastname", "Matthews")).and(QueryBuilder.eq("firstname", "John"));

    assertThat(actual.getQueryString(), is(expected.getQueryString()));
  }

  private interface SampleRepository {
View Full Code Here

    b1.setPages(521);

    template.insert(b1);

    Select select = QueryBuilder.select().all().from("book");
    select.where(QueryBuilder.eq("isbn", "123456-1"));

    Book b = template.selectOne(select, Book.class);

    log.debug("SingleSelect Book Title -> " + b.getTitle());
    log.debug("SingleSelect Book Author -> " + b.getAuthor());
View Full Code Here

    Assert.notNull(id);

    CassandraPersistentEntity<?> entity = mappingContext.getPersistentEntity(type);

    Select select = QueryBuilder.select().countAll().from(entity.getTableName().toCql());
    appendIdCriteria(select.where(), entity, id);

    Long count = queryForObject(select, Long.class);

    return count != 0;
  }
View Full Code Here

          "entity class [%s] uses a composite primary key class [%s] which this method can't support", type.getName(),
          entity.getIdProperty().getCompositePrimaryKeyEntity().getType().getName()));
    }

    Select select = QueryBuilder.select().all().from(entity.getTableName().toCql());
    select.where(QueryBuilder.in(entity.getIdProperty().getColumnName().toCql(), CollectionUtils.toArray(ids)));

    return select(select, type);
  }

  @Override
View Full Code Here

    if (entity == null) {
      throw new IllegalArgumentException(String.format("unknown entity class [%s]", type.getName()));
    }

    Select select = QueryBuilder.select().all().from(entity.getTableName().toCql());
    appendIdCriteria(select.where(), entity, id);

    return selectOne(select, type);
  }

  protected interface ClauseCallback {
View Full Code Here

    if (criteria == null) {
      return null;
    }

    Select select = QueryBuilder.select().all().from("TODO");
    select.where(criteria);

    if (LOG.isDebugEnabled()) {
      LOG.debug("Created query " + select.getQueryString());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.