Database Reference
In-Depth Information
UuidHelper.newTimeUuidBytes(), // using a UUID value that sorts by time
mutator.newColumnList(
mutator.newColumn("category", "videoPhone"),
mutator.newColumn("reportType", "POOR_PICTURE"),
mutator.newColumn("createdDate", NumberHelper.toBytes(System.currentTimeMillis())),
mutator.newColumn("capture", jpegBytes),
mutator.newColumn("comment") ));
mutator.execute(ConsistencyLevel.ONE);
Consider how much easier that is than using the API provided out of the box.
You can get the source code from http://code.google.com/p/pelops , and you can read some
samples and explanations of how to use Pelops at Dominic Williams' site, ht-
tp://ria101.wordpress.com .
If you're using Cassandra from a Java application, I encourage you to give Pelops a try.
Kundera (Java ORM)
Kundera is an object-relational mapping (ORM) implementation for Cassandra written using
Java annotations. It's available at http://kundera.googlecode.com under an Apache 2.0 license.
According to its author, Impetus Labs, the aim of Kundera is:
...tomakeworkingwithCassandradrop-deadsimpleandfun.Kunderadoesnotreinventthewheelby
makinganotherclientlibrary;ratheritleveragestheexistinglibrariesandbuilds—ontopofthem—a
wrap-aroundAPItohelpdevelopersdoawaywithunnecessaryboilerplatecodes,andprogramaneater-
and-cleanercodethatreducescode-complexityandimprovesquality.Andaboveall,improvesproductiv-
ity.
Kundera uses Pelops under the hood. A sample Java entity bean looks like this:
@Entity
@ColumnFamily(keyspace = "Keyspace1", family = "Band")
public class Band {
@Id
private String id;
@Column(name = "name")
private String name;
@Column(name = "instrument")
private String instrument;
You can perform a JPA query like this:
Query query = entityManager.createQuery("SELECT m from Band c where name='george'");
List<SimpleComment> list = query.getResultList();
Search WWH ::




Custom Search