Package com.datastax.driver.core

Examples of com.datastax.driver.core.RegularStatement


    public void should_get_statement() throws Exception {
        //Given
        wrapper = new RegularStatementWrapper(CompleteBean.class, rs, new Object[] { 1 }, ONE, NO_LISTENER, NO_SERIAL_CONSISTENCY);

        //When
        final RegularStatement expectedRs = wrapper.getStatement();

        //Then
        assertThat(expectedRs).isSameAs(rs);
    }
View Full Code Here


    entity.getVersion().incr(2L);

        manager.update(entity);

        RegularStatement statement = select().from("CompleteBean").where(eq("id",bindMarker()));

    CompleteBean foundEntity = manager.typedQuery(CompleteBean.class,statement,entity.getId()).getFirst();

    CompleteBean rawEntity = manager.initAndRemoveProxy(foundEntity);
View Full Code Here

    public void should_execute_native_batch() {
        // create persistence manager -- pm
        Batch batch = manager.createBatch();
        batch.startBatch();

        RegularStatement statement = QueryBuilder.insertInto(ValuelessEntity.TABLE_NAME).value("id", 234L);
        batch.batchNativeStatement(statement);

        ValuelessEntity entity = new ValuelessEntity(123L);
        batch.insert(entity);
View Full Code Here

        manager.insert(entity1);
        manager.insert(entity2);


        final RegularStatement statement = select("name","age_in_years","friends","followers","preferences")
                .from("CompleteBean").where(eq("id", bindMarker("id")));

        final CountDownLatch latch = new CountDownLatch(1);
        final AtomicReference<Object> successSpy = new AtomicReference<>();
        FutureCallback<Object> successCallBack = new FutureCallback<Object>() {
View Full Code Here

                exceptionSpy.getAndSet(t);
                latch.countDown();
            }
        };

        final RegularStatement insert = insertInto("completebean").value("id",bindMarker("id"));
        final RegularStatement delete = delete().from("completebean").where(eq("name","test"));

        //When
        manager.nativeQuery(insert, id).asyncExecute(successCallBack);
        manager.nativeQuery(delete).asyncExecute(exceptionCallBack);
View Full Code Here

        manager.insert(entity4);
        manager.insert(entity5);

        List<String> possibleNames = Arrays.asList("DuyHai", "Paul", "George", "John", "Helen");

        RegularStatement statement = select().all().from("CompleteBean").limit(6);
        statement.setFetchSize(2);

        final AchillesFuture<Iterator<TypedMap>> futureIterator = manager.nativeQuery(statement).asyncIterator();

        while (!futureIterator.isDone()) {
            Thread.sleep(10);
View Full Code Here

            public void onFailure(Throwable t) {
                latch.countDown();
            }
        };

        final RegularStatement selectStar = select().from("CompleteBean").where(eq("id", bindMarker("id")));
        final List<CompleteBean> list1 = manager.typedQuery(CompleteBean.class, selectStar, paul.getId()).asyncGet(successCallBack1).get();
        final CompleteBean foundJohn = manager.typedQuery(CompleteBean.class, selectStar, john.getId()).asyncGetFirst(successCallBack2).get();

        assertThat(list1).hasSize(1);
View Full Code Here

            public void onFailure(Throwable t) {
                latch.countDown();
            }
        };

        final RegularStatement selectStar = select().from("CompleteBean").where(eq("id", bindMarker("id")));

        final AchillesFuture<CompleteBean> futurePaul = manager.rawTypedQuery(CompleteBean.class, selectStar, paul.getId()).asyncGetFirst(successCallBack1);
        final AchillesFuture<CompleteBean> futureJohn = manager.rawTypedQuery(CompleteBean.class, selectStar, john.getId()).asyncGetFirst(successCallBack2);

        CompleteBean foundPaul = futurePaul.get();
View Full Code Here

        Map<String, Object> expectedCurrentValues = ImmutableMap.<String, Object>of("[applied]", false, "name", "John");

        CompleteBean entity = builder().randomId().name("John").buid();
        manager.insert(entity);

        final RegularStatement statement = update("CompleteBean").with(set("name","Helen"))
                .where(eq("id",entity.getId())).onlyIf(eq("name","Andrew"));

        //When
        final NativeQuery nativeQuery = manager.nativeQuery(statement,casResultListener(listener));
        nativeQuery.execute();
View Full Code Here

        entity.setWelcomeTweet(welcomeTweet);

        entity.getVersion().incr(10L);
        batch.update(entity);

        final RegularStatement selectLabel = select("label").from("CompleteBean").where(eq("id", entity.getId()));
        Map<String, Object> result = manager.nativeQuery(selectLabel).first();
        assertThat(result).isNull();

        RegularStatement selectCounter = select("counter_value").from("achilles_counter_table")
                .where(eq("fqcn", CompleteBean.class.getCanonicalName()))
                .and(eq("primary_key", entity.getId().toString()))
                .and(eq("property_name", "version"));

        result = manager.nativeQuery(selectCounter).first();
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.RegularStatement

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.