Alexey Zinoviev presented this paper on the JPoint'15 conference javapoint.ru/talks/#zinoviev.
This paper covers next topics: Java, JPA, Morphia, Hibernate OGM, Spring Data, Hector, Kundera, NoSQL, Mongo, Cassandra, HBase, Riak
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
1. Speaker : Alexey Zinoviev
Mom, I so wish Hibernate for my NoSQL
database...
2. About
● I am a scientist. The area of my interests includes machine
learning, traffic jams prediction, BigData algorythms.
● But I'm a programmer, so I'm interested in NoSQL databases,
Java, Android, Hadoop, Spark.
15. Flower varieties I
Data
Model
Performance Scalability Flexibility Complexity Functionality
Key–
value
Stores
high high high none variable (none)
Column
Store
high high moderate low minimal
Document
Store
high variable
(high)
high low variable (low)
Graph
Database
variable variable high high graph theory
Relational
Database
variable variable low moderate relational algebra
16. Flower varieties II
Database Data model Query API Data storage system
Cassandra Column Family Thrift Memtable/SSTable
CouchDB Documents Map/Reduce Append-only-B-tree
Hbase Column Family Thrift, REST Memtable/SSTable on HDFS
MongoDB Documents Cursor B-tree
Neo4j Edges/Verticies Graph On-disk linked lists
Riak Key/Value Nested hashes,
REST
Hash
17. Flower varieties III
Database Secondary
indexes
MapReduce Free form queries
Cassandra yes no CQL (no joins)
CouchDB yes JavaScript Views
Hbase no Hadoop weak support
MongoDB yes JavaScript Full stack without joins
Neo4j yes (with Lucene) no Search, graph operations
Riak yes JavaScript, Erlang weak support, Lucene
20. ● CRUD + column iteration, Partial support of JPA standart
● Consistency Level can be set per Column Family and per
operation type (Read, Write)
● Based on Thrift RPC protocol (1 response per 1 request)
● Mapping a Collection (POJO property) to columns
● Inheritance through ‘single table’
● Custom converters to/from byte[]
Hector
21.
22.
23. ● DataStax developed a new protocol that doesn't have RPC
limitations (Asynchronous I/O)
● Low-level API with simple mapping
● Works with CQL3
● QueryBuilder reminds CriteriaAPI
● Accessor-annotated interfaces
DataStax Java Driver
27. ● Achilles : well documented and provides transactions
● Astyanax : connection pool, thread safety and pagination
● Pelops : old project, good bycicle
● PlayORM : strange but powerful thing
● Easy-Cassandra : simple annotations + CRUD
● Thrift as low level API
Other Cassandra’s OM
29. ● Integrated with Spring, Guice and other DI frameworks
● Lifecycle Method Annotations (@PrePersist, @PostLoad)
● Built on top of Mongo Java Driver
● More better than old-style BSON-object quering
● Fluent Query API :
ds.createQuery(MyEntity.class).filter("foo >",12).order("date, -
foo");
Morphia
36. ● Jongo : mongo - shell queries in Java-code
● EclipseLink : different support of different NoSQL
databases
● MJORM : Google Code, XML mapping + MQL (SQL syntax
for Mongo data extracting)
● DataNucleus : support many Js as JDO, JPA
Mongo - mongo
38. ● Java Persistence (JPA) support for NoSQL solutions
● JP-QL queries are converted in native backend queries
● Hibernate Search as indexing engine and use full-text
queries
● You can call flush(), commit() and demarcate transactions
● It supports only MongoDB, Neo4j, Infinispan, Ehcache
Hibernate OGM
43. ● Redis: Rapid access for reads and writes. No need to be durable
● RBDMS: Needs transactional updates and has tabular structure.
● Riak: Needs high availability across multiple locations. Can merge
inconsistent writes
● Neo4j: Rapidly traverse links between friends and ratings.
● MongoDB: Lots of reads, infrequent writes. Powerful aggregation
mechanism.
● Cassandra: Large-scale analytics on large cluster. High volume of writes
on multiple nodes
Polyglot Persistance
44. Kundera : Polyglot approach
● Atomicity guarantee and Transaction management
● Strictly JPA 2.1 compatible
● It supports Cassandra, Mongo, Hbase, Redis, Neo4j and etc
● @Embedded and @ElementCollection for ColumnFamily
and nested documents
● OneToMany, OneToOne, ManyToMany relationships
● Not full JPQL support for different database
46. If you developing a project for...
● a U.S. company - Morphia or Hector
● a transnational company with history of merging - Kundera
● a Deutsche Bank - Hibernate OGM or SpringData
● a Russian company, or one in in the former U.S.S.R. - native
drivers is the best approach (you will spend so many time)
● … just to play - Jongo, Easy - Cassandra and EclipseLink
47. Your Country Needs You!
● Know your cases and data!
● Choose right database!
● Choose right framework!
● In Soviet Russia backends
are waiting you!