Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A cassandra plugin to the java persistence platform Datanucleus
Branch: master
Failed to load latest commit information.
src added an new algorithm for ranges based on the global retrieval of al…
NOTICE.txt NOTICE file that should be include in the project.
README.mkd Update readme with link to official plugin



A simple DataNucleus plugin for Java object persistence in Cassandra 0.6.x. For 0.7.x support checkTodd's version.

This is not currently supported as you may guess, for the official version go to:


The current status is as follows:

  • It allows persistence of simple attributes, one-to-one relations, one-to-many and many-to-many relations through collections and maps.

  • It creates a datanucleus.schema every time some element is missing in Cassandra schema, until Cassandra allows dynamic changes to it.

  • It works with Cassandra-0.6.x, under Thrift interface. Data-store code isolation will be improved however, to allow other versions to be used.

  • Basic schema creation tool(beta). Schema creation

  • It supports multiple indexes on each class, here each can only contain one field.

  • It now supports basic JDOQL queries with support to ranges and searches based on indexed fields. Usages


To build the plugin place the following libs in a folder named lib:

  • apache-cassandra-0.6.1.jar
  • libthrift-r917130.jar
  • datanucleus-core-2.1.0-m2.jar (*)

Then type ant or ant dist.

(*) Due to API issues, I chose to use the new core version of datanucleus, this however demands that you compile and generate a jar for the new JDO API, when using the plugin. Sources under: JDO2-api

Sample code

Get the JDO sample in Datanucleus at:


  • Alter the JDOQL tests from, as for now, only simple ranges are supported(read/delete) and searches based on single indexed fields.
  • Define the primary key for each class, as the native strategy is not supported (use for example @PrimaryKey annotations in the classes).
  • In the add/edit:

    javax.jdo.option.ConnectionURL=cassandra:ORMTest://localhost:9160 (*) datanucleus.cassandra.replicaPlacementStrategy=org.apache.cassandra.locator.RackUnawareStrategy (+)
    datanucleus.cassandra.replicationFactor=1 (+)
    datanucleus.cassandra.endPointSnitch = org.apache.cassandra.locator.EndPointSnitch (+)
    datanucleus.metadata.validate=false datanucleus.autoCreateSchema=true

  • Run the sample according to the original instructions.

(*)The connection URL follows the pattern: cassandra:keySpace://hostaname:port,hostname:port,... cassandra:keySpace://hostname:port,ring:default_port can also be used, where the plugin is responsible for the discover of other nodes using the default port.
(+)Used to generate the schema, that for now is only the generation of a file as said above.


Updated source and an issue tracker are available at:

Your feedback is welcome.

Something went wrong with that request. Please try again.