Database Reference
In-Depth Information
+ Constants.KEYSPACE + ".blogs "
+ "("
+ "id uuid PRIMARY KEY, "
+ "blog_name varchar, "
+ "author varchar, "
+ "email varchar, "
+ "password varchar"
+ ")";
[-- snip --]
Session conn = CassandraConnection.getSession();
[--snip--]
conn.execute(BLOGS_TABLE_DEF);
[-- snip --]
conn.close();
Object mapping
The DataStax Java driver provides an easy-to use, annotation-based object mapper, which
can help you avoid a lot of code bloat and marshalling effort. Here is an example of the
Blog object that maps to the blogs table:
@Table(keyspace = Constants.KEYSPACE, name = "blogs")
public class Blog extends AbstractVO<Blog> {
@PartitionKey
private UUID id;
@Column(name = "blog_name")
private String blogName;
private String author;
private String email;
private String password;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getBlogName() {
return blogName;
Search WWH ::




Custom Search