Created
March 18, 2010 00:38
-
-
Save phatduckk/335914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ModelExample { | |
public static void main(String[] args) { | |
ClientManager clientManager = ClientManager.factory(Cassandra.Client.class); | |
clientManager.addHost("localhost", 9160); | |
Primitives p = new Primitives(); | |
p.setSomeBoolean(false); | |
p.setSomeByte(Byte.MAX_VALUE); | |
p.setSomeChar('a'); | |
p.setSomeDouble(Double.MAX_VALUE); | |
p.setSomeFloat(Float.MAX_VALUE); | |
p.setSomeInt(Integer.MAX_VALUE); | |
p.setSomeLong(Long.MAX_VALUE); | |
p.setSomeShort(Short.MAX_VALUE); | |
p.setSomeString("hello"); | |
p.save(); | |
Primitives p2 = (Primitives) new Primitives().load(p.getKey()); | |
System.out.println(p2.getSomeDouble()); | |
} | |
} | |
//////// | |
@Model(keyspace="Arin", columnFamily="Standard1", superColumn="") | |
public class Primitives extends BaseModel { | |
@ModelProperty | |
private int someInt; | |
@ModelProperty | |
private long someLong; | |
@ModelProperty | |
private short someShort; | |
@ModelProperty | |
private byte someByte; | |
@ModelProperty | |
private String someString; | |
@ModelProperty | |
private float someFloat; | |
@ModelProperty | |
private double someDouble; | |
@ModelProperty | |
private boolean someBoolean; | |
@ModelProperty | |
private char someChar; | |
public Primitives() { | |
} | |
// impl getters & setters and abstract methods here.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment