Hercules is a lightweight yet powerful ORM with an approach to provide OOP way of interacting with Cassandra-specific data model.
Current version is 0.4.2. Has been used only in several internal projects. Use it in production at your own risk.
Maven repo (currently hosted on BinTray – add this to <repositories>
in your pom.xml
):
<repository>
<id>appmetr-repo</id>
<url>http://dl.bintray.com/appmetr/maven</url>
</repository>
Maven dependency (add this to <dependencies>
in your pom.xml
):
<dependency>
<groupId>com.appmetr</groupId>
<artifactId>hercules</artifactId>
<version>0.4.2</version>
</dependency>
https://bintray.com/appmetr/maven/hercules/0.4.2/files
Latest binaries and sources on BinTray: hercules-0.4.2.jar
Latest source code: hercules-0.4.2-sources.jar
Fork on GitHub: https://github.com/appmetr/hercules
Browse releases on BinTray: https://bintray.com/appmetr/maven/hercules
Hercules requires Java SE 5 or higher.
Create you first entity:
@Entity
public class Cat {
@Id String id;
String name;
}
Create entity DAO:
public class CatDAO extends AbstractDAO<Cat, String> {
public CatDAO(Hercules hercules) {
super(Cat.class, hercules);
}
}
Create Hercules config:
Set<Class> entityClasses = new HashSet<Class>();
entityClasses.add(Cat.class);
HerculesConfig config = new HerculesConfig(
"Test", // keyspace name
"localhost:9160", // cassandra host and port
10, // max active connections
1, // replication factor
true, // is schema modification enabled
entityClasses
);
Create Hercules and perform queries:
Hercules hercules = HerculesFactory.create(config);
hercules.init();
CatDAO catDAO = new CatDAO(hercules);
Cat cat = catDAO.get("cat01");
hercules.shutdown();
Coming soon...
Coming soon...
Coming soon...