Tuesday, August 3, 2010

Implementing the comments: Writing a comment as a supercolumn

So far we have looked at simple column families but now it’s time to tackle super columns. We are still working with the BloggyAppy design from Arin Sarkissian. We are using some code from Hector’s test code.

Following Arin’s specification the Comments Column Family is going to look like this

Comments: {
   Coment: A Comment,
   Email: andy@abc.com
   Coment: A Comment,
   Email: andy@abc.com

Lets be clear Blog-Slug will be the Slug entry for the blog that is being commented on. This is the key we will be looking for. Under that are the supercolumn entries, with a key of type UUID. This contains a number of columns that are the entries for the comments. So to add a comment we can do this:
Keyspace ks = client.getKeyspace("BloggyAppy");
ColumnPath cp = new ColumnPath("Comments");
java.util.UUID timeUUID=getTimeUUID();              
ks.insert(slugValue, cp, bytes("andy@abc.com"));
ks.insert(slugValue, cp, bytes("AComment"));

SlugValue is essentially the title. Note that getTimeUUID is defined as:

public static java.util.UUID getTimeUUID()
return java.util.UUID.fromString(new com.eaio.uuid.UUID().toString());


  1. Awesome information. I am really surprised with this topic. Keep up the good work and post more here to read.


    1. Thanks for the informative and useful information shared on the blog. I really enjoyed reading the article. Low Cost Website Design Company

  2. Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.

    commercial trash receptacles

  3. Thanks so much with this fantastic new web site. I'm very fired up to show it to anyone. It makes me so satisfied your vast understanding and wisdom have a new channel on the world.

  4. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.
    Read More: App development Company
    Mobial App development Company

  5. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking. Web development belize

  6. Nice post this one is, thanks for sharing this information with us.
    Shopify Development Company