Package com.netflix.astyanax

Examples of com.netflix.astyanax.MutationBatch.withRow()


 

    @Test
    public void testTtlValues() throws Exception {
        MutationBatch mb = keyspace.prepareMutationBatch();
        mb.withRow(CF_TTL, "row")
          .putColumn("TTL0", "TTL0", 0)
          .putColumn("TTLNULL", "TTLNULL", null)
          .putColumn("TTL1", "TTL1", 1);
       
        mb.execute();
View Full Code Here


    public void delete(K id) throws PersistenceException {
        try {
            if (verbose)
                LOG.info(String.format("%s : Deleting id '%s'", columnFamily.getName(), id));
            MutationBatch mb = getMutationBatch();
            mb.withRow(columnFamily, id).delete();
            if (autoCommit)
                mb.execute();
        } catch(Exception e) {
            throw new PersistenceException("failed to delete entity " + id, e);
        }
View Full Code Here

        MutationBatch mb = getMutationBatch();       
        try {
            if (verbose)
                LOG.info(String.format("%s : Delete ids '%s'", columnFamily.getName(), ids.toString()));
            for (K id : ids) {
                mb.withRow(columnFamily, id).delete();
            }
            if (autoCommit)
                mb.execute();
        } catch(Exception e) {
            throw new PersistenceException("failed to delete entities " + ids, e);
View Full Code Here

                                                                      // just
                                                                      // Class
                                                                      // anyway

        MutationBatch mutationBatch = keyspace.prepareMutationBatch();
        mutationBatch.withRow(columnFamily,
                mapping.getIdValue(item, idFieldClass)).delete();
        mutationBatch.execute();
    }

    /**
 
View Full Code Here

                                                                      // just
                                                                      // Class
                                                                      // anyway

        MutationBatch mutationBatch = keyspace.prepareMutationBatch();
        ColumnListMutation<String> columnListMutation = mutationBatch.withRow(
                columnFamily, mapping.getIdValue(item, idFieldClass));
        mapping.fillMutation(item, columnListMutation);

        mutationBatch.execute();
    }
View Full Code Here

    public void testFunctionalQuery() throws Exception {
      MutationBatch m = keyspace.prepareMutationBatch();

        for (char keyName = 'A'; keyName <= 'Z'; keyName++) {
            String rowKey = Character.toString(keyName);
            ColumnListMutation<String> cfmStandard = m.withRow(CF_STANDARD1, rowKey);
            for (char cName = 'a'; cName <= 'z'; cName++) {
                cfmStandard.putColumn(Character.toString(cName),
                        (int) (cName - 'a') + 1, null);
            }
            m.withCaching(true);
View Full Code Here

    @Test
    public void testHasValue() throws Exception {

      MutationBatch m = keyspace.prepareMutationBatch();
      m.withRow(CF_USER_INFO, "acct1234")
      .putColumn("firstname", "john", null)
      .putColumn("lastname", "smith", null)
      .putColumn("address", "555 Elm St", null)
      .putColumn("age", 30, null)
      .putEmptyColumn("empty");
View Full Code Here

        LOG.info("Starting testDelete...");

        String rowKey = "DeleteMe_testDelete";

        MutationBatch m = keyspace.prepareMutationBatch();
        m.withRow(CF_STANDARD1, rowKey).putColumn("Column1", "X", null).putColumn("Column2", "X", null);
        m.execute();

        Column<String> column = keyspace.prepareQuery(CF_STANDARD1).getRow(rowKey).getColumn("Column1").execute().getResult();
        Assert.assertEquals("X", column.getStringValue());
       
View Full Code Here

        Column<String> column = keyspace.prepareQuery(CF_STANDARD1).getRow(rowKey).getColumn("Column1").execute().getResult();
        Assert.assertEquals("X", column.getStringValue());
       
        m = keyspace.prepareMutationBatch();
        m.withRow(CF_STANDARD1, rowKey).deleteColumn("Column1");
        m.execute();

        column = keyspace.prepareQuery(CF_STANDARD1).getRow(rowKey).getColumn("Column1").execute().getResult();
        Assert.assertNull(column);
View Full Code Here

        int nColumns = 100;
        int pageSize = 25;

        // Insert a bunch of rows
        MutationBatch m = keyspace.prepareMutationBatch();
        ColumnListMutation<String> rm = m.withRow(CF_STANDARD1, rowKey);

        for (int i = 0; i < nColumns; i++) {
            rm.putEmptyColumn("" + i, null);
        }
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.