SlideShare a Scribd company logo
Cassandra Java Libraries 
DuyHai DOAN, Technical Advocate 
@doanduyhai
Agenda! 
@doanduyhai 
2 
Cassandra Unit 
Java Driver Mapping Module 
Achilles
Cassandra Unit! 
@doanduyhai 
3 
• start an embedded Cassandra server 
• useful for unit testing 
• mature project, created at August 5th 2011 
• designed around Thrift & Hector 
• propose a JUnit rule for CQL
Cassandra Unit 
Demo
Java Driver Object Mapper! 
@doanduyhai 
5 
• simple mapper 
• KISS 
• annotations à-la JPA (but no JPA dependencies) 
• templating system à-la Spring Data
Java Driver Object Mapper! 
Mapping 
@doanduyhai 
6 
@Table(keyspace = "mapper_module", name = "users") 
public class User { 
@PartitionKey 
private String login; 
private String name; 
// getters and setters omitted... 
}
Java Driver Object Mapper! 
Usage 
@doanduyhai 
7 
MappingManager manager = new MappingManager(session); 
Mapper mapper = manager.mapper(User.class); 
User user = mapper.get("jdoe@fiction.com"); 
mapper.saveAsync(new User("hsue@fiction.com")); 
mapper.delete("jdoe@fiction.com");
Java Driver Object Mapper! 
Accessors (SpringData template-like) definition 
@doanduyhai 
8 
@Accessor 
interface UserAccessor { 
@Query("SELECT * FROM users LIMIT :max") 
Result<User> firstNUsers(@Param("max") int limit); 
}
Java Driver Object Mapper! 
@doanduyhai 
9 
Accessors usage 
UserAccessor accessor = manager.createAccessor(UserAccessor.class); 
List<User> users = accessor.firstNUsers(10).all(); 
for (User user : users) { 
System.out.println( profile.getAddress().getZip() ); 
}
Java Driver Object Mapper 
Demo
Achilles! 
@doanduyhai 
11 
Why ? 
• started in late 2012, when mapper module did not exists 
• more involved and more features than the mapper module 
• different annotations set (may converge)
Achilles 
Demo
Achilles Architecture! 
@doanduyhai 
13 
Entities Parsing 
Schema Validation 
Prepare Statements 
Custom Configs 
Meta Data 
Dirty Checking (opt.) 
Interceptors 
Type Encoding 
Dynamic Logging 
Object Mapping 
Proxy Building (opt.) 
Bootstrap 
Runtime
Main API! 
@doanduyhai 
14 
manager.insert(entity) 
manager.update(entity) 
manager.remove(entity) 
manager.find(Entity.class, primaryKey)
Main API! 
@doanduyhai 
15 
Slice query, typed query 
RegularStatement select = select().from(“user_messages”) 
.where(eq(“user_id”,bindMarker())) 
.and(gte(asList(“message_folder”), bindMarker())) 
.and(lt(asList(“message_folder”, “date”), bindMarker())) 
.limit(10); 
List<Message> messages = manager.typedQuery(Message.class, select, 
userId, asList(“forums”), asList(“forums”, uuid1)) 
.get();
Main API! 
@doanduyhai 
16 
Native query 
RegularStatement nativeQuery = new SimpleStatement(“SELECT * FROM 
Message WHERE … LIMIT 1”); 
TypedMap firstMessage = manager.nativeQuery(nativeQuery).first(); 
String interlocutor = firstMessage.getTyped(“interlocutor”); 
//Or 
String interlocutor = firstMessage.<String>getTyped(“interlocutor”);
Main API! 
@doanduyhai 
17 
Counter 
Batch mode 
Strategies (insert, naming) 
Options
Documentation! 
@doanduyhai 
18 
Comprehensive Github WIKI 
Twitter-clone demo app (demo.achilles.io) 
Versioned documentation (HTML & PDF) 
JavaDoc
RoadMap! 
@doanduyhai 
19 
Asynchronous API (branch Asynchronous) 
• main API ( insert(), update(), …) 
• slice, typed & native queries 
C* 2.1 user defined types (UDT) 
Reactive ? (RxJava) 
ElasticSearch integration (@olivierbourgain)
! " 
! 
Q & R
Thank You 
@doanduyhai 
duy_hai.doan@datastax.com 
https://academy.datastax.com/

More Related Content

PDF
Cassandra rapid prototyping with achilles
PDF
Effective cassandra development with achilles
PDF
Understanding backbonejs
PPT
BackboneJs
ODP
Indexed db
PPTX
Backbonejs for beginners
PPTX
Save data in to sqlite
PDF
Backbone js in action
Cassandra rapid prototyping with achilles
Effective cassandra development with achilles
Understanding backbonejs
BackboneJs
Indexed db
Backbonejs for beginners
Save data in to sqlite
Backbone js in action

What's hot (20)

PDF
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...
PPTX
Data Management in Microsoft HDInsight: How to Move and Store Your Data
PDF
Dicoding Developer Coaching #27: Android | Membuat Aplikasi Support Online Ma...
PPTX
Creating Single Page Web App using Backbone JS
PPTX
BackboneJS Training - Giving Backbone to your applications
PDF
Backbone
PPTX
Object Oriented Programing in JavaScript
PPTX
20141001 delapsley-oc-openstack-final
KEY
【前端Mvc】之豆瓣说实践
PDF
Intro to BackboneJS + Intermediate Javascript
PPTX
Hibernate Performance Tuning @JUG Thüringen
PDF
Better Data Persistence on Android
PDF
In-depth changes to Drupal 8 javascript
PDF
Introduction to Backbone.js for Rails developers
PDF
React.js触ってみた 吉澤和香奈
ODP
MobileCity:Core Data
PPTX
PDF
ERGroupware
PDF
前端MVC之BackboneJS
PPT
RapidApp presentation for Cincinnati.pm
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...
Data Management in Microsoft HDInsight: How to Move and Store Your Data
Dicoding Developer Coaching #27: Android | Membuat Aplikasi Support Online Ma...
Creating Single Page Web App using Backbone JS
BackboneJS Training - Giving Backbone to your applications
Backbone
Object Oriented Programing in JavaScript
20141001 delapsley-oc-openstack-final
【前端Mvc】之豆瓣说实践
Intro to BackboneJS + Intermediate Javascript
Hibernate Performance Tuning @JUG Thüringen
Better Data Persistence on Android
In-depth changes to Drupal 8 javascript
Introduction to Backbone.js for Rails developers
React.js触ってみた 吉澤和香奈
MobileCity:Core Data
ERGroupware
前端MVC之BackboneJS
RapidApp presentation for Cincinnati.pm
Ad

Viewers also liked (9)

PDF
Achilles presentation
PDF
Cassandra Drivers and Tools
PDF
Cassandra NodeJS driver & NodeJS Paris
PDF
Cassandra introduction apache con 2014 budapest
PDF
Cassandra data structures and algorithms
PDF
Cassandra presentation at NoSQL
PDF
Cassandra nice use cases and worst anti patterns
PDF
Introduction to Cassandra & Data model
PDF
Cassandra techniques de modelisation avancee
Achilles presentation
Cassandra Drivers and Tools
Cassandra NodeJS driver & NodeJS Paris
Cassandra introduction apache con 2014 budapest
Cassandra data structures and algorithms
Cassandra presentation at NoSQL
Cassandra nice use cases and worst anti patterns
Introduction to Cassandra & Data model
Cassandra techniques de modelisation avancee
Ad

Similar to Cassandra java libraries (20)

PDF
Cassandra drivers and libraries
PPTX
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
PDF
Evolution of database access technologies in Java-based software projects
PDF
Introduction to jOOQ
PPTX
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
PPTX
NoSQL: The first New Jakarta EE Specification (DWX 2019)
PDF
NoSQL, no Limits, lots of Fun!
PPTX
Spring Data - Intro (Odessa Java TechTalks)
PDF
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
PDF
eBuddy | Cassandra Data Access in Java
PDF
Cassandra data access
PPTX
Cassandra Java APIs Old and New – A Comparison
PPT
JDBC Connectivity Model
PDF
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
PPTX
NoSQL Endgame JCON Conference 2020
PDF
Palestra Java + NoSQL = Iniciativa JNoSQL no TDC Florianópolis
PDF
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
PPTX
EclipseCon 2021 NoSQL Endgame
PPTX
JNoSQL: The Definitive Solution for Java and NoSQL Databases
PPTX
DataStax NYC Java Meetup: Cassandra with Java
Cassandra drivers and libraries
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
Evolution of database access technologies in Java-based software projects
Introduction to jOOQ
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL, no Limits, lots of Fun!
Spring Data - Intro (Odessa Java TechTalks)
JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [C...
eBuddy | Cassandra Data Access in Java
Cassandra data access
Cassandra Java APIs Old and New – A Comparison
JDBC Connectivity Model
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
NoSQL Endgame JCON Conference 2020
Palestra Java + NoSQL = Iniciativa JNoSQL no TDC Florianópolis
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
EclipseCon 2021 NoSQL Endgame
JNoSQL: The Definitive Solution for Java and NoSQL Databases
DataStax NYC Java Meetup: Cassandra with Java

More from Duyhai Doan (20)

PDF
Pourquoi Terraform n'est pas le bon outil pour les déploiements automatisés d...
PDF
Le futur d'apache cassandra
PDF
Big data 101 for beginners devoxxpl
PDF
Big data 101 for beginners riga dev days
PDF
Datastax enterprise presentation
PDF
Datastax day 2016 introduction to apache cassandra
PDF
Datastax day 2016 : Cassandra data modeling basics
PDF
Sasi, cassandra on the full text search ride At Voxxed Day Belgrade 2016
PDF
Apache cassandra in 2016
PDF
Spark zeppelin-cassandra at synchrotron
PDF
Sasi, cassandra on full text search ride
PDF
Cassandra 3 new features @ Geecon Krakow 2016
PDF
Algorithme distribués pour big data saison 2 @DevoxxFR 2016
PDF
Apache Zeppelin @DevoxxFR 2016
PDF
Cassandra 3 new features 2016
PDF
Cassandra introduction 2016
PDF
Spark cassandra integration 2016
PDF
Spark Cassandra 2016
PDF
Cassandra introduction 2016
PDF
Apache zeppelin the missing component for the big data ecosystem
Pourquoi Terraform n'est pas le bon outil pour les déploiements automatisés d...
Le futur d'apache cassandra
Big data 101 for beginners devoxxpl
Big data 101 for beginners riga dev days
Datastax enterprise presentation
Datastax day 2016 introduction to apache cassandra
Datastax day 2016 : Cassandra data modeling basics
Sasi, cassandra on the full text search ride At Voxxed Day Belgrade 2016
Apache cassandra in 2016
Spark zeppelin-cassandra at synchrotron
Sasi, cassandra on full text search ride
Cassandra 3 new features @ Geecon Krakow 2016
Algorithme distribués pour big data saison 2 @DevoxxFR 2016
Apache Zeppelin @DevoxxFR 2016
Cassandra 3 new features 2016
Cassandra introduction 2016
Spark cassandra integration 2016
Spark Cassandra 2016
Cassandra introduction 2016
Apache zeppelin the missing component for the big data ecosystem

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Monthly Chronicles - July 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
cuic standard and advanced reporting.pdf
PDF
Modernizing your data center with Dell and AMD
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
KodekX | Application Modernization Development
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Cloud computing and distributed systems.
PPTX
Big Data Technologies - Introduction.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Monthly Chronicles - July 2025
The AUB Centre for AI in Media Proposal.docx
cuic standard and advanced reporting.pdf
Modernizing your data center with Dell and AMD
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
KodekX | Application Modernization Development
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
NewMind AI Weekly Chronicles - August'25 Week I
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Cloud computing and distributed systems.
Big Data Technologies - Introduction.pptx

Cassandra java libraries

  • 1. Cassandra Java Libraries DuyHai DOAN, Technical Advocate @doanduyhai
  • 2. Agenda! @doanduyhai 2 Cassandra Unit Java Driver Mapping Module Achilles
  • 3. Cassandra Unit! @doanduyhai 3 • start an embedded Cassandra server • useful for unit testing • mature project, created at August 5th 2011 • designed around Thrift & Hector • propose a JUnit rule for CQL
  • 5. Java Driver Object Mapper! @doanduyhai 5 • simple mapper • KISS • annotations à-la JPA (but no JPA dependencies) • templating system à-la Spring Data
  • 6. Java Driver Object Mapper! Mapping @doanduyhai 6 @Table(keyspace = "mapper_module", name = "users") public class User { @PartitionKey private String login; private String name; // getters and setters omitted... }
  • 7. Java Driver Object Mapper! Usage @doanduyhai 7 MappingManager manager = new MappingManager(session); Mapper mapper = manager.mapper(User.class); User user = mapper.get("jdoe@fiction.com"); mapper.saveAsync(new User("hsue@fiction.com")); mapper.delete("jdoe@fiction.com");
  • 8. Java Driver Object Mapper! Accessors (SpringData template-like) definition @doanduyhai 8 @Accessor interface UserAccessor { @Query("SELECT * FROM users LIMIT :max") Result<User> firstNUsers(@Param("max") int limit); }
  • 9. Java Driver Object Mapper! @doanduyhai 9 Accessors usage UserAccessor accessor = manager.createAccessor(UserAccessor.class); List<User> users = accessor.firstNUsers(10).all(); for (User user : users) { System.out.println( profile.getAddress().getZip() ); }
  • 10. Java Driver Object Mapper Demo
  • 11. Achilles! @doanduyhai 11 Why ? • started in late 2012, when mapper module did not exists • more involved and more features than the mapper module • different annotations set (may converge)
  • 13. Achilles Architecture! @doanduyhai 13 Entities Parsing Schema Validation Prepare Statements Custom Configs Meta Data Dirty Checking (opt.) Interceptors Type Encoding Dynamic Logging Object Mapping Proxy Building (opt.) Bootstrap Runtime
  • 14. Main API! @doanduyhai 14 manager.insert(entity) manager.update(entity) manager.remove(entity) manager.find(Entity.class, primaryKey)
  • 15. Main API! @doanduyhai 15 Slice query, typed query RegularStatement select = select().from(“user_messages”) .where(eq(“user_id”,bindMarker())) .and(gte(asList(“message_folder”), bindMarker())) .and(lt(asList(“message_folder”, “date”), bindMarker())) .limit(10); List<Message> messages = manager.typedQuery(Message.class, select, userId, asList(“forums”), asList(“forums”, uuid1)) .get();
  • 16. Main API! @doanduyhai 16 Native query RegularStatement nativeQuery = new SimpleStatement(“SELECT * FROM Message WHERE … LIMIT 1”); TypedMap firstMessage = manager.nativeQuery(nativeQuery).first(); String interlocutor = firstMessage.getTyped(“interlocutor”); //Or String interlocutor = firstMessage.<String>getTyped(“interlocutor”);
  • 17. Main API! @doanduyhai 17 Counter Batch mode Strategies (insert, naming) Options
  • 18. Documentation! @doanduyhai 18 Comprehensive Github WIKI Twitter-clone demo app (demo.achilles.io) Versioned documentation (HTML & PDF) JavaDoc
  • 19. RoadMap! @doanduyhai 19 Asynchronous API (branch Asynchronous) • main API ( insert(), update(), …) • slice, typed & native queries C* 2.1 user defined types (UDT) Reactive ? (RxJava) ElasticSearch integration (@olivierbourgain)
  • 20. ! " ! Q & R
  • 21. Thank You @doanduyhai duy_hai.doan@datastax.com https://academy.datastax.com/