SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
Cassandra rapid prototyping 
with Achilles 
www.achilles.io 1 
@doanduyhai
DuyHai DOAN 
Java/Cassandra freelance developer 
! 
! 
Daytime: + 
! 
! 
At night: + 
www.achilles.io 2 
@doanduyhai
What is Achilles ? 
Yet another C* object mapper 
www.achilles.io 3 
@doanduyhai
What is Achilles ? 
More than a C* object mapper 
www.achilles.io 4 
@doanduyhai
Demo 
TDD with Achilles 
www.achilles.io 5 
@doanduyhai
Main API 
•manager.insert(entity) 
! 
•manager.update(managedEntity) 
! 
•manager.remove(entity) 
! 
•manager.find(Entity.class, primaryKey) 
www.achilles.io 6 
@doanduyhai
Thread safety for persistence manager 
No JOINS means 
www.achilles.io 7 
@doanduyhai
Thread safety for persistence manager 
No JOINS means 
! 
! 
No complex object graph 
www.achilles.io 8 
@doanduyhai
Thread safety for persistence manager 
No JOINS means 
! 
! 
No complex object graph 
! 
! 
No state to keep 
www.achilles.io 9 
@doanduyhai
What’s about proxy ? 
proxifiedEntity = manager.find(Entity.class, primaryKey) 
Dirty check 
www.achilles.io 10 
@doanduyhai 
ProxifiedEntity 
Real 
Entity 
State 
Setters interception
Why proxies ? 
emc² Albert EINSTEIN GERMANY 
User einstein = manager.find(User.class,”emc²”); 
! 
einstein.setCountry(“USA”); 
! 
manager.insert(einstein); 
emc² Albert EINSTEIN GERMANY emc² Albert EINSTEIN USA 
www.achilles.io 11 
@doanduyhai 
Waste of space !!
Why proxies ? 
emc² Albert EINSTEIN GERMANY 
User einstein = manager.find(User.class,”emc²”); 
! 
einstein.setCountry(“USA”); 
! 
manager.update(einstein); 
emc² Albert EINSTEIN GERMANY USA 
www.achilles.io 12 
@doanduyhai
Slice query 
List<Message> entities = manager.sliceQuery(Message.class) 
.forSelect() 
.withPartitionComponents(10L) 
.fromClusterings(“forums”).toClusterings(“forums”, uuid1) 
.limit(10).fromInclusiveToExclusiveBounds() 
.get(); 
SELECT * FROM Message 
WHERE user_id = 10 
AND (message_folder) ≥ (‘forums’) 
AND (message_folder, date) < (‘forums’, uuid1) 
ORDER BY message_folder ASC LIMIT 10; 
www.achilles.io 13 
@doanduyhai
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(); 
www.achilles.io 14 
@doanduyhai
Native query 
RegularStatement nativeQuery = new SimpleStatement(“SELECT * FROM Message 
WHERE … LIMIT 20”); 
! 
List<TypedMap> messages = manager.nativeQuery(nativeQuery).get(); 
! 
TypedMap firstMessage = messages.get(0); 
! 
// with normal Map<String, Object> 
// String interlocutor = (String) map.get(“interlocutor”); 
! 
String interlocutor = firstMessage.getTyped(“interlocutor”); 
String interlocutor = firstMessage.<String>getTyped(“interlocutor”); 
www.achilles.io 15 
@doanduyhai
Counter API 
Special proxy type 
www.achilles.io 16 
@doanduyhai 
public Long get(); 
! 
public void incr(); 
! 
public void incr(Long increment); 
! 
public void decr(); 
! 
public void decr(Long decrement);
Options 
•Setting C* special options 
•Apply to main API insert(), update(), remove() … 
www.achilles.io 17 
@doanduyhai 
manager.insert(user, 
OptionsBuilder 
.withConsistency(QUORUM) 
.ttl(10) 
.timestamp(1357949499999L) 
.ifNotExists() 
);
Lifecycle interceptors 
Hooks into persistence lifecycle 
www.achilles.io 18 
@doanduyhai 
public interface Interceptor<T> { 
public void onEvent(T entity); 
public List<Event> events(); 
} 
! 
public enum Event { 
PRE_PERSIST, POST_PERSIST, PRE_UPDATE, POST_UPDATE, PRE_REMOVE, 
POST_REMOVE, POST_LOAD; 
}
Bean Validation (JSR-303) 
Just a built-in interceptor, PRE_PERSIST, PRE_UPDATE 
@Entity(table = “entity”) 
public class Entity { 
@Id 
private Long id; 
! 
@Column 
@NotEmpty 
private String name; 
} 
www.achilles.io 19 
@doanduyhai
Batch mode 
C* 2.0 atomic batches 
Batch batch = manager.createBatch(); 
! 
batch.startBatch(); 
! 
batch.insert(new Entity(…..)); 
batch.update(…..); 
batch.remove(…..); 
batch.removeById(MyEntity.class, primaryKey); 
! 
batch.endBatch(); 
www.achilles.io 20 
@doanduyhai
Documentation 
•Comprehensive Github WIKI 
! 
•Twitter-clone demo app (demo.achilles.io) 
! 
•Versioned documentation (HTML & PDF) 
! 
•JavaDoc 
www.achilles.io 21 
@doanduyhai
Documentation 
www.achilles.io 22 
@doanduyhai
Asynchronous 
•Available for 
➡ main API ( insert(), update(), …) 
➡ slice queries 
➡ typed & native queries 
www.achilles.io 23 
@doanduyhai
Roadmap for future 
•C* 2.1 user defined types (UDT) & tuples 
! 
•Reactive programming (RxJava) 
! 
•Transparent search integration (ElasticSearch, Solr…) 
www.achilles.io 24 
@doanduyhai
Where to download ? 
•www.achilles.io 
! 
•Google “Achilles Cassandra” ☞ first result 
www.achilles.io 25 
@doanduyhai
Take away 
•More than a simple object mapper 
! 
•Productivity-oriented 
! 
•KISS 
! 
•Documented 
www.achilles.io 26 
@doanduyhai
! " 
Q & A 
www.achilles.io 27 @doanduyhai

Contenu connexe

Tendances

20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final
David Lapsley
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
WO Community
 
【前端Mvc】之豆瓣说实践
【前端Mvc】之豆瓣说实践【前端Mvc】之豆瓣说实践
【前端Mvc】之豆瓣说实践
taobao.com
 

Tendances (20)

Backbonejs for beginners
Backbonejs for beginnersBackbonejs for beginners
Backbonejs for beginners
 
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...
Dicoding Developer Coaching #32: Android | Reactive Programming dengan RxJava...
 
Consume Spring Data Rest with Angularjs
Consume Spring Data Rest with AngularjsConsume Spring Data Rest with Angularjs
Consume Spring Data Rest with Angularjs
 
20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final
 
Creating Single Page Web App using Backbone JS
Creating Single Page Web App using Backbone JSCreating Single Page Web App using Backbone JS
Creating Single Page Web App using Backbone JS
 
Better Data Persistence on Android
Better Data Persistence on AndroidBetter Data Persistence on Android
Better Data Persistence on Android
 
Hibernate Performance Tuning @JUG Thüringen
Hibernate Performance Tuning @JUG ThüringenHibernate Performance Tuning @JUG Thüringen
Hibernate Performance Tuning @JUG Thüringen
 
Backbone js in action
Backbone js in actionBackbone js in action
Backbone js in action
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
 
ERGroupware
ERGroupwareERGroupware
ERGroupware
 
Data Management in Microsoft HDInsight: How to Move and Store Your Data
Data Management in Microsoft HDInsight: How to Move and Store Your DataData Management in Microsoft HDInsight: How to Move and Store Your Data
Data Management in Microsoft HDInsight: How to Move and Store Your Data
 
Object Oriented Programing in JavaScript
Object Oriented Programing in JavaScriptObject Oriented Programing in JavaScript
Object Oriented Programing in JavaScript
 
【前端Mvc】之豆瓣说实践
【前端Mvc】之豆瓣说实践【前端Mvc】之豆瓣说实践
【前端Mvc】之豆瓣说实践
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Backbone
BackboneBackbone
Backbone
 
第一次用Parse就深入淺出
第一次用Parse就深入淺出第一次用Parse就深入淺出
第一次用Parse就深入淺出
 
BackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applicationsBackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applications
 
React.js触ってみた 吉澤和香奈
React.js触ってみた 吉澤和香奈React.js触ってみた 吉澤和香奈
React.js触ってみた 吉澤和香奈
 
In-depth changes to Drupal 8 javascript
In-depth changes to Drupal 8 javascriptIn-depth changes to Drupal 8 javascript
In-depth changes to Drupal 8 javascript
 

En vedette (8)

Achilles presentation
Achilles presentationAchilles presentation
Achilles presentation
 
Cassandra Drivers and Tools
Cassandra Drivers and ToolsCassandra Drivers and Tools
Cassandra Drivers and Tools
 
Cassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapestCassandra introduction apache con 2014 budapest
Cassandra introduction apache con 2014 budapest
 
Cassandra NodeJS driver & NodeJS Paris
Cassandra NodeJS driver & NodeJS ParisCassandra NodeJS driver & NodeJS Paris
Cassandra NodeJS driver & NodeJS Paris
 
Cassandra data structures and algorithms
Cassandra data structures and algorithmsCassandra data structures and algorithms
Cassandra data structures and algorithms
 
Cassandra nice use cases and worst anti patterns
Cassandra nice use cases and worst anti patternsCassandra nice use cases and worst anti patterns
Cassandra nice use cases and worst anti patterns
 
Introduction to Cassandra & Data model
Introduction to Cassandra & Data modelIntroduction to Cassandra & Data model
Introduction to Cassandra & Data model
 
Cassandra techniques de modelisation avancee
Cassandra techniques de modelisation avanceeCassandra techniques de modelisation avancee
Cassandra techniques de modelisation avancee
 

Similaire à Cassandra rapid prototyping with achilles

CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
Fermin Galan
 
Jquery dojo slides
Jquery dojo slidesJquery dojo slides
Jquery dojo slides
helenmga
 

Similaire à Cassandra rapid prototyping with achilles (20)

Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
 
Minicurso Android
Minicurso AndroidMinicurso Android
Minicurso Android
 
jQuery in the [Aol.] Enterprise
jQuery in the [Aol.] EnterprisejQuery in the [Aol.] Enterprise
jQuery in the [Aol.] Enterprise
 
#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
 
Programming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.ioProgramming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.io
 
Michael Häusler – Everyday flink
Michael Häusler – Everyday flinkMichael Häusler – Everyday flink
Michael Häusler – Everyday flink
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
Android Architecture Components with Kotlin
Android Architecture Components with KotlinAndroid Architecture Components with Kotlin
Android Architecture Components with Kotlin
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
Green dao
Green daoGreen dao
Green dao
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applications
 
Appcelerator titanium
Appcelerator titaniumAppcelerator titanium
Appcelerator titanium
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
 
Jquery dojo slides
Jquery dojo slidesJquery dojo slides
Jquery dojo slides
 

Plus de Duyhai Doan

Plus de Duyhai Doan (20)

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

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Dernier (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Cassandra rapid prototyping with achilles

  • 1. Cassandra rapid prototyping with Achilles www.achilles.io 1 @doanduyhai
  • 2. DuyHai DOAN Java/Cassandra freelance developer ! ! Daytime: + ! ! At night: + www.achilles.io 2 @doanduyhai
  • 3. What is Achilles ? Yet another C* object mapper www.achilles.io 3 @doanduyhai
  • 4. What is Achilles ? More than a C* object mapper www.achilles.io 4 @doanduyhai
  • 5. Demo TDD with Achilles www.achilles.io 5 @doanduyhai
  • 6. Main API •manager.insert(entity) ! •manager.update(managedEntity) ! •manager.remove(entity) ! •manager.find(Entity.class, primaryKey) www.achilles.io 6 @doanduyhai
  • 7. Thread safety for persistence manager No JOINS means www.achilles.io 7 @doanduyhai
  • 8. Thread safety for persistence manager No JOINS means ! ! No complex object graph www.achilles.io 8 @doanduyhai
  • 9. Thread safety for persistence manager No JOINS means ! ! No complex object graph ! ! No state to keep www.achilles.io 9 @doanduyhai
  • 10. What’s about proxy ? proxifiedEntity = manager.find(Entity.class, primaryKey) Dirty check www.achilles.io 10 @doanduyhai ProxifiedEntity Real Entity State Setters interception
  • 11. Why proxies ? emc² Albert EINSTEIN GERMANY User einstein = manager.find(User.class,”emc²”); ! einstein.setCountry(“USA”); ! manager.insert(einstein); emc² Albert EINSTEIN GERMANY emc² Albert EINSTEIN USA www.achilles.io 11 @doanduyhai Waste of space !!
  • 12. Why proxies ? emc² Albert EINSTEIN GERMANY User einstein = manager.find(User.class,”emc²”); ! einstein.setCountry(“USA”); ! manager.update(einstein); emc² Albert EINSTEIN GERMANY USA www.achilles.io 12 @doanduyhai
  • 13. Slice query List<Message> entities = manager.sliceQuery(Message.class) .forSelect() .withPartitionComponents(10L) .fromClusterings(“forums”).toClusterings(“forums”, uuid1) .limit(10).fromInclusiveToExclusiveBounds() .get(); SELECT * FROM Message WHERE user_id = 10 AND (message_folder) ≥ (‘forums’) AND (message_folder, date) < (‘forums’, uuid1) ORDER BY message_folder ASC LIMIT 10; www.achilles.io 13 @doanduyhai
  • 14. 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(); www.achilles.io 14 @doanduyhai
  • 15. Native query RegularStatement nativeQuery = new SimpleStatement(“SELECT * FROM Message WHERE … LIMIT 20”); ! List<TypedMap> messages = manager.nativeQuery(nativeQuery).get(); ! TypedMap firstMessage = messages.get(0); ! // with normal Map<String, Object> // String interlocutor = (String) map.get(“interlocutor”); ! String interlocutor = firstMessage.getTyped(“interlocutor”); String interlocutor = firstMessage.<String>getTyped(“interlocutor”); www.achilles.io 15 @doanduyhai
  • 16. Counter API Special proxy type www.achilles.io 16 @doanduyhai public Long get(); ! public void incr(); ! public void incr(Long increment); ! public void decr(); ! public void decr(Long decrement);
  • 17. Options •Setting C* special options •Apply to main API insert(), update(), remove() … www.achilles.io 17 @doanduyhai manager.insert(user, OptionsBuilder .withConsistency(QUORUM) .ttl(10) .timestamp(1357949499999L) .ifNotExists() );
  • 18. Lifecycle interceptors Hooks into persistence lifecycle www.achilles.io 18 @doanduyhai public interface Interceptor<T> { public void onEvent(T entity); public List<Event> events(); } ! public enum Event { PRE_PERSIST, POST_PERSIST, PRE_UPDATE, POST_UPDATE, PRE_REMOVE, POST_REMOVE, POST_LOAD; }
  • 19. Bean Validation (JSR-303) Just a built-in interceptor, PRE_PERSIST, PRE_UPDATE @Entity(table = “entity”) public class Entity { @Id private Long id; ! @Column @NotEmpty private String name; } www.achilles.io 19 @doanduyhai
  • 20. Batch mode C* 2.0 atomic batches Batch batch = manager.createBatch(); ! batch.startBatch(); ! batch.insert(new Entity(…..)); batch.update(…..); batch.remove(…..); batch.removeById(MyEntity.class, primaryKey); ! batch.endBatch(); www.achilles.io 20 @doanduyhai
  • 21. Documentation •Comprehensive Github WIKI ! •Twitter-clone demo app (demo.achilles.io) ! •Versioned documentation (HTML & PDF) ! •JavaDoc www.achilles.io 21 @doanduyhai
  • 23. Asynchronous •Available for ➡ main API ( insert(), update(), …) ➡ slice queries ➡ typed & native queries www.achilles.io 23 @doanduyhai
  • 24. Roadmap for future •C* 2.1 user defined types (UDT) & tuples ! •Reactive programming (RxJava) ! •Transparent search integration (ElasticSearch, Solr…) www.achilles.io 24 @doanduyhai
  • 25. Where to download ? •www.achilles.io ! •Google “Achilles Cassandra” ☞ first result www.achilles.io 25 @doanduyhai
  • 26. Take away •More than a simple object mapper ! •Productivity-oriented ! •KISS ! •Documented www.achilles.io 26 @doanduyhai
  • 27. ! " Q & A www.achilles.io 27 @doanduyhai