Hector-Client #Scala Wrapper for Cassandra

A few days ago i had to use Cassandra for my special project, so i went on to search for usable clients.

First i tried Cascal, which felt a bit clunky, so i decided to try Cassie (Twitter) which couldn't create Keyspaces in code.

So i was left with Hector which is a Java client. Since i don't like Java's bureaucracy, i decided to write a little Wrapper in Scala.

If you look at Hector's examples, you'll find that you have to handle things like Keyspace and an Entity Manager (if you're going for the ORM), which didn't feel very comfortable.

Since i am leaving on sunday for a vacation, plus i have to code shitloads of lines until then, i will make this one short. ;)

It basically wraps everything we need in implicits, so the only thing you need in your current context when handling Entities is a Keyspace (it can also be a virtual!)

Example is in the main method. You will need to adjust a few lines of code to get it working in your setup!


  • I haven't slept that much
  • This was just a quick hack to see if i could do it :)

The code

Here is the Connection and Entity Manager:

To make things nice and easy for our traits, here is the implicit in the Model-package:

To top it off, i've prepared two sample classes with referencing (ModelB entity references to a ModelA entity) :

Here is a link to the full gist: https://gist.github.com/3317399

best regards

Flattr me!

Tell your friends!