Skip to main content

Knowing more about Easy-Cassandra Project

Posted by otaviojava on February 21, 2012 at 8:02 AM PST
   
 
 
    
    Easy-Cassandra is a framework ORM API and a high client for Apache Cassandra in java, with this is possible persist information from the Java Object in easy way. For this is only necessary add some annotations in some fields and your class. It works like an abstraction's tier in the Thrift, doing call for Cassandra.
The Easy-Cassandra uses the Thrift implementation and has like the main objective be one simple ORM (Object relational manager). It need the jdk 7 for run, because some parts in your code was replaced reflection for invoke dynamic. So will have a behavior faster than other framework. The Easy-Cassandra was the first framework compatible with Cassandra version above 0.8 and the first one to use CQL (Cassandra Query Language). For read a class, it use the invokedynamic, fifteen time faster than reflection.
 

Features

 

  • An ORM easy to use in Cassandra
  • Need only use some Annotations in a class to persist
  • Persists many Java Objects in way extremely easy (e.g: all primitives types, java.Lang.String, java.lang.BigDecimal, java.io.File, etc.).
  • Read and Write in Cassandra with Level Consistency.
  • The first framework ORM in Cassandra to compatives with version above 0.8.0.
  • The first to use CQL
  • compatible with CQL 2.0
  • The first to use invokedynamic instead to reflection
  • In the Apache version 2.0 license
 

Java Objects Supported

 
The Easy-Cassandra has support for the Object java bellow:
 
  • all primitives types (int, long, float, double, short, byte, boolean)
  • java.lang.Boolean
  • java.util.Date
  • java.lang.Double
  • java.lang.Float
  • java.lang.Integer
  • java.lang.Long
  • java.lang.String
  • java.lang.Boolean
  • java.lang.Byte
  • java.lang.Short
  • java.lang.Character
  • java.io.File
  • java.nio.file.Path

 

 About Versions

 

The current and stable version is 1.0.7

 

Version: 1.0.7
  • update cassandra-thrift to 1.0.7
Version: 1.0.6
  • Fixes bug with File
  • Support Calendar interface
Version: 1.0.5
  • Can now store files
  • Support java.io.File and java.nio.file.Path
Version: 1.0.4
  • more performance
  •  less memory
  •  now is supported all primitives types
  •  now is supported Byte, character, Short, BigInteger and BigDecimal
Version: 1.0.3
  • Fixes bug with result
  • update for Thrift 1.0.6
  • Log now using java.util.loggin
Version: 1.0.2
  • Fixes bug with Boolean's Object
  • Now the Cassandra's lib is supported this way is possible use every Cassandra above of the version 0.8.0
Version: 1.0.1
  • Allowed use ColumnValue and ColumnFamilyValue in default mode this way its get the field's name
  • Fixes bug in Reflection

 

 

 

Beyond version

 

  • Call exception when there are not neither Index Key nor Key Value in the class
  • Select Key from 'in'  CQL command
  • Create automatically the ColumnFamily in Run Time
  • Create automatically the IndexValue in Run Time
  • Suport with cql 2.0
  • Support with one and more Index
  • Feed Object with Cassandra Query Language

     Example: List persons= cassandraQuery.executeQuery("select * from Person").getResultList();

 

 

Simple Sample

 

For use this recourse is very simple like sample bellow:

 @ColumnFamilyValue(nome = "person")

public class Person implements Serializable { 

private static final long serialVersionUID = 3L;

@KeyValue(auto=false)
private Long id;

@IndexValue
@ColumnValue(nome = "name")
private String name;

@ColumnValue(nome = "year")
private Integer year;

@EnumeratedValue(nome="sex")
private Sex sex;

@EmbeddedValue
private Address address;
//getter and setter
}
Simple of annotations in a class
 
 
public class PersonDAO {

private Persistence persistence;

public PersonDAO() {
persistence = EasyCassandraManager.getPersistence("javabahia", "localhost", 9160);
}

public void create(Person bean) {

   persistence.insert(bean);
}

public void remove(Person bean) {
   persistence.delete(bean);
}

public void remove(Long id){
    persistence.deleteByKeyValue(id, Person.class);
}

public void update(Person bean) {

   persistence.update(bean);
}
public Person retrieve(Object id) {

   return(Person) persistence.findByKey(id, Person.class);
}
@SuppressWarnings("unchecked")
public List listAll() {

  return persistence.findAll(Person.class);
}

@SuppressWarnings("unchecked")
public List listByIndex(Object index) {
   return persistence.findByIndex(index, Person.class);
}
}

Sample of DAO performing call for the Cassandra 

More information

 
 

If you would like do question about, contribute, share experience, do anything for the project. Do part of Group in Google Groups: https://groups.google.com/group/easy-cassandra/