{"id":33641,"date":"2014-12-08T01:00:28","date_gmt":"2014-12-07T23:00:28","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=33641"},"modified":"2014-12-07T19:10:34","modified_gmt":"2014-12-07T17:10:34","slug":"getting-started-with-apache-cassandra-and-java-part-ii","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html","title":{"rendered":"Getting Started with Apache Cassandra and Java (Part II)"},"content":{"rendered":"<h2>Requirements<\/h2>\n<p>To follow this tutorial, you should already have a running instance of Cassandra (<a href=\"http:\/\/planetcassandra.org\/getting-started-with-ccm-cassandra-cluster-manager\/\">a small cluster would be good<\/a>, but not necessary), the Datastax Java driver installed (<a href=\"http:\/\/www.javacodegeeks.com\/2014\/11\/getting-started-with-apache-cassandra-and-java-part-i.html\">refer to Part I<\/a>), and have gone through the 10 minute walkthrough here: <a href=\"http:\/\/planetcassandra.org\/create-a-keyspace-and-table\/\" target=\"_blank\">http:\/\/planetcassandra.org\/create-a-keyspace-and-table\/<\/a>.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<h2>Try it out<\/h2>\n<p>For this demo, we\u2019re going to be creating a simple console application, almost identical to the one in Part I, only this time we will be exploring connection policies, prepared statements, and query builder. Open a text editor and create a java file with a \u201cGettingStartedTwo\u201d class and a single main method.<\/p>\n<pre class=\"brush:java\">public class GettingStartedTwo {\r\n \r\npublic static void main(String[] args) {\r\n \r\n        Cluster cluster;\r\n        Session session;\r\n        ResultSet results;\r\n        Row rows;<\/pre>\n<p>Then we can connect to our cluster and create a session instance.<\/p>\n<pre class=\"brush:java\">\/\/ Connect to the cluster and keyspace \"demo\"\r\nCluster cluster = Cluster.builder()\r\n                  .addContactPoint(\"localhost\")\r\n                  .build();\r\nSession session = cluster.connect(\"demo\");<\/pre>\n<p>But wait, now that we are running a cluster instead of a single instance, we\u2019ll want to put some safeguards in place incase of a failover. We can do this using a RetryPolicy.The retry policy determines the default behavior to adopt when a request either times out or a node is unavailable. We\u2019re using the DefaultRetryPolicy in this case, which will retry queries either:<\/p>\n<ul>\n<li>on a read timeout, when enough replicas have replied but the data wasn\u2019t received.<\/li>\n<li>on a write timeout, if we timeout while writing the log used by batch statements.<\/li>\n<\/ul>\n<pre class=\"brush:java\">cluster = Cluster\r\n    .builder()\r\n    .addContactPoint(\"192.168.0.30\")\r\n    .withRetryPolicy(DefaultRetryPolicy.INSTANCE)\r\n    .build();\r\nsession = cluster.connect(\"demo\");<\/pre>\n<p>A load balancing policy will determine which node it is to run a query. Since a client can read or write to any node, sometimes that can be inefficient. If a node receives a read or write owned on another node, it will coordinate that request for the client. We can use a load balancing policy to control that action. The TokenAwarePolicy ensures that the request will go to the node or replica responsible for the data indicated by the primary key. It is wrapped around DCAwareRoundRobinPolicy to make sure the requests stay in the local datacenter. \u00a0This is a good choice for us as, although we only have our one local cluster at the moment, we are already thinking about the next step, expanding to multi-datacenter.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:java\">cluster = Cluster\r\n        .builder()\r\n        .addContactPoint(\"192.168.0.30\")\r\n        .withRetryPolicy(DefaultRetryPolicy.INSTANCE)\r\n        .withLoadBalancingPolicy(\r\n                         new TokenAwarePolicy(new DCAwareRoundRobinPolicy()))\r\n        .build();\r\nsession = cluster.connect(\"demo\");<\/pre>\n<p>Now that you are connected to the \u201cdemo\u201d keyspace, let\u2019s insert a user into the \u201cusers\u201d table. This is exactly what we were doing in Part I earlier, but we\u2019re doing it a little differently this time. Using prepared a statement is \u00a0more secure and the most performant way to get data into or out of our database. Prepared statements only need to be parsed once by the cluster, and then then values are bound to variables and then we execute the bound statement to read\/write data from the cluster.<\/p>\n<pre class=\"brush:java\">\/\/ Insert one record into the users table\r\n        PreparedStatement statement = session.prepare(\r\n \r\n        \"INSERT INTO users\" + \"(lastname, age, city, email, firstname)\"\r\n                + \"VALUES (?,?,?,?,?);\");\r\n \r\n        BoundStatement boundStatement = new BoundStatement(statement);\r\n \r\n        session.execute(boundStatement.bind(\"Jones\", 35, \"Austin\",\r\n                \"bob@example.com\", \"Bob\"));<\/pre>\n<p>Using the Java driver, we can easily pull the user back out. In Part I of Getting Started with Apache Cassandra with Java, we used a string representation of CQL. Now (and for the rest of the tutorial), we are going to do the same with Query Builder, which is more secure and saves us from potential CQL injection attacks.<\/p>\n<pre class=\"brush:java\">\/\/ Use select to get the user we just entered\r\n        Statement select = QueryBuilder.select().all().from(\"demo\", \"users\")\r\n                .where(eq(\"lastname\", \"Jones\"));\r\n        results = session.execute(select);\r\n        for (Row row : results) {\r\n            System.out.format(\"%s %d \\n\", row.getString(\"firstname\"),\r\n                    row.getInt(\"age\"));\r\n        }<\/pre>\n<p>Since it\u2019s Bob\u2019s birthday, we are going to update his age.<\/p>\n<pre class=\"brush:java\">\/\/ Update the same user with a new age\r\n        Statement update = QueryBuilder.update(\"demo\", \"users\")\r\n                .with(QueryBuilder.set(\"age\", 36))\r\n                .where((QueryBuilder.eq(\"lastname\", \"Jones\")));\r\n                        session.execute(update);\r\n\/\/ Select and show the change\r\n        select = QueryBuilder.select().all().from(\"demo\", \"users\")\r\n                .where(eq(\"lastname\", \"Jones\"));\r\n        results = session.execute(select);\r\n        for (Row row : results) {\r\n            System.out.format(\"%s %d \\n\", row.getString(\"firstname\"),\r\n                    row.getInt(\"age\"));<\/pre>\n<p>Now let\u2019s delete Bob from the table, and print out all the information left in the users table. You\u2019ll notice that Bob\u2019s information no longer comes back after being deleted (others might, if you have inserted users previously).<\/p>\n<pre class=\"brush:java\">\/\/ Delete the user from the users table\r\n           Statement delete = QueryBuilder.delete().from(\"users\")\r\n                .where(QueryBuilder.eq(\"lastname\", \"Jones\"));\r\n        results = session.execute(delete);\r\n        \/\/ Show that the user is gone\r\n           select = QueryBuilder.select().all().from(\"demo\", \"users\");\r\n        results = session.execute(select);\r\n        for (Row row : results) {\r\n            System.out.format(\"%s %d %s %s %s\\n\", row.getString(\"lastname\"),\r\n                    row.getInt(\"age\"), row.getString(\"city\"),\r\n                    row.getString(\"email\"), row.getString(\"firstname\"));\r\n        }<\/pre>\n<p>Make sure that the connection closes once you are done.<\/p>\n<pre class=\"brush:java\">\/\/ Clean up the connection by closing it\r\ncluster.close();\r\n    }\r\n}<\/pre>\n<p>CQL is very similar to SQL, in many cases the same syntax will work. \u00a0This makes querying for data very straightforward if you have a background with relational databases.You have just managed to connect to a Cassandra cluster and perform queries against a live (local) database. Hopefully this demonstrates just how easy it is to use Cassandra using the Java driver. \u00a0A Gist of the complete console application for this sample is <a href=\"https:\/\/gist.github.com\/beccam\/fd8080820a7f08bac9d4\">available on GitHub<\/a>.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/planetcassandra.org\/getting-started-with-apache-cassandra-and-java-part-2\/\">Getting Started with Apache Cassandra and Java (Part II)<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/jcg\/\">JCG partner<\/a> Rebecca Mills at the <a href=\"http:\/\/planetcassandra.org\/\">Planet Cassandra<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Requirements To follow this tutorial, you should already have a running instance of Cassandra (a small cluster would be good, but not necessary), the Datastax Java driver installed (refer to Part I), and have gone through the 10 minute walkthrough here: http:\/\/planetcassandra.org\/create-a-keyspace-and-table\/. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Try it out For this demo, we\u2019re going &hellip;<\/p>\n","protected":false},"author":609,"featured_media":53,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[111,113],"class_list":["post-33641","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-apache-cassandra","tag-nosql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Getting Started with Apache Cassandra and Java (Part II)<\/title>\n<meta name=\"description\" content=\"Requirements To follow this tutorial, you should already have a running instance of Cassandra (a small cluster would be good, but not necessary), the\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting Started with Apache Cassandra and Java (Part II)\" \/>\n<meta property=\"og:description\" content=\"Requirements To follow this tutorial, you should already have a running instance of Cassandra (a small cluster would be good, but not necessary), the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-07T23:00:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-cassandra-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rebecca Mills\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/rebccamills\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rebecca Mills\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html\"},\"author\":{\"name\":\"Rebecca Mills\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/e39089bbfc25a635a6e29574ddab3add\"},\"headline\":\"Getting Started with Apache Cassandra and Java (Part II)\",\"datePublished\":\"2014-12-07T23:00:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html\"},\"wordCount\":664,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-cassandra-logo.jpg\",\"keywords\":[\"Apache Cassandra\",\"NoSQL\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html\",\"name\":\"Getting Started with Apache Cassandra and Java (Part II)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-cassandra-logo.jpg\",\"datePublished\":\"2014-12-07T23:00:28+00:00\",\"description\":\"Requirements To follow this tutorial, you should already have a running instance of Cassandra (a small cluster would be good, but not necessary), the\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-cassandra-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/apache-cassandra-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2014\\\/12\\\/getting-started-with-apache-cassandra-and-java-part-ii.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Getting Started with Apache Cassandra and Java (Part II)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/e39089bbfc25a635a6e29574ddab3add\",\"name\":\"Rebecca Mills\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/97c407ac900dc0b57e952a94cccf5104b0a3a7499a4958f86aa241213d79f02b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/97c407ac900dc0b57e952a94cccf5104b0a3a7499a4958f86aa241213d79f02b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/97c407ac900dc0b57e952a94cccf5104b0a3a7499a4958f86aa241213d79f02b?s=96&d=mm&r=g\",\"caption\":\"Rebecca Mills\"},\"description\":\"Rebecca Mills is a Junior Evangelist at DataStax, the company that delivers Apache Cassandra\u2122 to the enterprise. She is interested in the new Cassandra user experience and is involved making it more approachable for everyone. She holds a B.Sc in biochemistry from Memorial University of Newfoundland and has been known to go on a bit about genome analysis.\",\"sameAs\":[\"http:\\\/\\\/planetcassandra.org\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/rebccamills\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/rebecca-mills\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting Started with Apache Cassandra and Java (Part II)","description":"Requirements To follow this tutorial, you should already have a running instance of Cassandra (a small cluster would be good, but not necessary), the","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html","og_locale":"en_US","og_type":"article","og_title":"Getting Started with Apache Cassandra and Java (Part II)","og_description":"Requirements To follow this tutorial, you should already have a running instance of Cassandra (a small cluster would be good, but not necessary), the","og_url":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-12-07T23:00:28+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-cassandra-logo.jpg","type":"image\/jpeg"}],"author":"Rebecca Mills","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/rebccamills","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Rebecca Mills","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html"},"author":{"name":"Rebecca Mills","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/e39089bbfc25a635a6e29574ddab3add"},"headline":"Getting Started with Apache Cassandra and Java (Part II)","datePublished":"2014-12-07T23:00:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html"},"wordCount":664,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-cassandra-logo.jpg","keywords":["Apache Cassandra","NoSQL"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html","url":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html","name":"Getting Started with Apache Cassandra and Java (Part II)","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-cassandra-logo.jpg","datePublished":"2014-12-07T23:00:28+00:00","description":"Requirements To follow this tutorial, you should already have a running instance of Cassandra (a small cluster would be good, but not necessary), the","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-cassandra-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/apache-cassandra-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2014\/12\/getting-started-with-apache-cassandra-and-java-part-ii.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Getting Started with Apache Cassandra and Java (Part II)"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/e39089bbfc25a635a6e29574ddab3add","name":"Rebecca Mills","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/97c407ac900dc0b57e952a94cccf5104b0a3a7499a4958f86aa241213d79f02b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/97c407ac900dc0b57e952a94cccf5104b0a3a7499a4958f86aa241213d79f02b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/97c407ac900dc0b57e952a94cccf5104b0a3a7499a4958f86aa241213d79f02b?s=96&d=mm&r=g","caption":"Rebecca Mills"},"description":"Rebecca Mills is a Junior Evangelist at DataStax, the company that delivers Apache Cassandra\u2122 to the enterprise. She is interested in the new Cassandra user experience and is involved making it more approachable for everyone. She holds a B.Sc in biochemistry from Memorial University of Newfoundland and has been known to go on a bit about genome analysis.","sameAs":["http:\/\/planetcassandra.org\/","https:\/\/x.com\/https:\/\/twitter.com\/rebccamills"],"url":"https:\/\/www.javacodegeeks.com\/author\/rebecca-mills"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/33641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/609"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=33641"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/33641\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/53"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=33641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=33641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=33641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}