Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
JNoSQL
The Definitive Solution for Java
and NoSQL Database
Leonardo...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
About the Speakers
Leonardo Lima
• Computer engineer, server & embe...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Otávio Santana
• Software engineer, Tomitribe
• From Salvador, Braz...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
NoSQL
(Not Only SQL)
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
What defines NoSQL databases?
— No fixed data structure
— Not an AC...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
ACID x BASE
Basically
Available,
Soft State,
Eventual consistency
A...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Key/Value
— AmazonDynamo
— AmazonS3
— Redis
— Scalaris
— Voldemort
...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Row key
Column Family
— Hbase
— Cassandra
— Scylla
— Clouddata
— Si...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Document
— AmazonSimpleD
— Apache CouchDB
— Couchbase
— MongoDB
— R...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Graph
— Neo4J
— InfoGrid
— Sones
— HyperGraphDB
Apollo
Ares
Kratos
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Multi-model
— OrientDB
◦ graph, document
— Couchbase
◦ key-value, d...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
SQL -> NoSQL
SQL Key-Value Column
Family
Document Graph
Table Bucke...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Scalability x Complexity
Scalability
Complexity
Key/Value
Document
...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
NoSQL
In Java
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
How Java application interact with…
SQL NoSQL
Logic
DAO
JPA
JDBC
JP...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
For example: for a Document DB…
BaseDocument baseDocument = new Bas...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
A first attempt on independence…
Logic
DAO
JPA
— Hibernate OGM
— Ec...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
… brings a bunch of issues!
— Can’t save asynchronously
◦ No callba...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
JNoSQL
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
What is JNoSQL?
— Mapping API - Artemis
— Communication API - Diana...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Eclipse JNoSQL
— Eclipse Foundation
— Apache v2 + EPL 1.0
— API to ...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
JNoSQL - Diana
— Communication layer API
— One API for each DB type...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
JNoSQL – Diana APIs
Key/Value Document
Column
Family
Graph
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Back to that Document DB…
DocumentEntity entity = DocumentEntity.of...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Names & Definitions
— Configuration
— Factory
— Manager
— Entity
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Names & Definitions
ColumnConfiguration<?> condition = new DriverCo...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Handling diversity (1)
ColumnEntity entity = ColumnEntity.of(COLUMN...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Handling diversity (2)
//mutiple implementation
entityManager.inser...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
JNoSQL - Artemis
— Based on CDI and Diana
— Heavy use of Annotation...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Names & Definitions
— Annotated Entities
— Template
— Repository
— ...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Annotaded Entities
— MappedSuperclass
— Entity
— Column
@Entity(”go...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Template
import static DocumentQuery.select;
@Inject DocumentTempla...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Repository
@Inject
@Database(DatabaseType.COLUMN)
private GodReposi...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Configuration
[ {
"description": "The couchbase document configurat...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Configuration
@Inject
@ConfigurationUnit
private DocumentCollection...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Expansibility
@Entity("person")
public class God {
@Column
private ...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Expansibility
interface GodRepository extends CassandraRepository<G...
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
JNoSQL
Community
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
NoSQL Vendors & Providers
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
JUGs & other communities
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Website
http://jnosql.org
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Mailing List
https://dev.eclipse.org/mailman/listinfo/jnosql-dev
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Repository
https://github.com/JNOSQL/
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Gitter
https://gitter.im/JNOSQL/developers
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Wiki
https://wiki.eclipse.org/JNoSQL
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
? & !
JNoSQL
#JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima
Thanks!
Upcoming SlideShare
Loading in …5
×

JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [CON4954]

1,153 views

Published on

JNoSQL is a framework and collection of tools that make integration between Java applications and NoSQL quick and easy—for developers as well as vendors. The API is easy to implement, so NoSQL vendors can quickly implement, test, and become compliant by themselves. And with its low learning curve and just a minimal set of artifacts, Java developers can start coding by worrying not about the complexity of specific NoSQL databases but only their core aspects (such as graph or document properties). Built with functional programming in mind, it leverages all the features of Java 8. This session covers how the API is structured, how it relates to the multiple NoSQL database types, and how you can get started and involved in this open source technology.

Published in: Technology
  • Be the first to comment

JavaOne 2017 - JNoSQL: The Definitive Solution for Java and NoSQL Database [CON4954]

  1. 1. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima JNoSQL The Definitive Solution for Java and NoSQL Database Leonardo Lima Otávio Santana
  2. 2. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima About the Speakers Leonardo Lima • Computer engineer, server & embedded sw developer • From São Paulo, Brasil, currently in Austin, TX • CTO at V2COM • Spec Lead – JSR363 – Units of Measurement • V2COM’s Representative at JCP Executive Committee [about.me/leomrlima]
  3. 3. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Otávio Santana • Software engineer, Tomitribe • From Salvador, Brazil • Java Champion, SouJava JUG Leader • Apache, Eclipse and OpenJDK Committer • Expert Group member in many JSRs • Representative at JCP EC for SouJava About the Speakers
  4. 4. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima NoSQL (Not Only SQL)
  5. 5. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima What defines NoSQL databases? — No fixed data structure — Not an ACID, but a BASE — Five different types ◦ Key/Value ◦ Column Family ◦ Document ◦ Graph ◦ Multi-Model
  6. 6. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima ACID x BASE Basically Available, Soft State, Eventual consistency Atomicity, Consistency, Isolation, Durability
  7. 7. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Key/Value — AmazonDynamo — AmazonS3 — Redis — Scalaris — Voldemort — Couchbase — Hazelcast Apollo Sun Aphrodite Love Ares War Light Music Beauty
  8. 8. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Row key Column Family — Hbase — Cassandra — Scylla — Clouddata — SimpleDb — DynamoDB Apollo Ares Kratos Duty {”Sun”,“Light”, ”Music”} Duty “War” SlainGods 13 Weapon “Sword”
  9. 9. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Document — AmazonSimpleD — Apache CouchDB — Couchbase — MongoDB — Riak { ”name”:”Diana”, ”father”:”Jupiter”, ”mother”:”Latona”, ”siblings”:{ ”name”: ”Apollo” }, ”godOf”: {”Hunt”} }
  10. 10. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Graph — Neo4J — InfoGrid — Sones — HyperGraphDB Apollo Ares Kratos
  11. 11. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Multi-model — OrientDB ◦ graph, document — Couchbase ◦ key-value, document — Elasticsearch ◦ document, graph — ArangoDB ◦ column family, graph, key-value
  12. 12. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima SQL -> NoSQL SQL Key-Value Column Family Document Graph Table Bucket Column Family Collection Row Key/Value pair Column Document Vertex Column Key/Value Pair Key/Value Pair Vertex/Edge properties Relationship Link Edge
  13. 13. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Scalability x Complexity Scalability Complexity Key/Value Document Column Family Graph
  14. 14. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima NoSQL In Java
  15. 15. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima How Java application interact with… SQL NoSQL Logic DAO JPA JDBC JPA JDBC JPA JDBC Logic DAO
  16. 16. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima For example: for a Document DB… BaseDocument baseDocument = new BaseDocument(); baseDocument.addAttribute(name, value); JsonObject jsonObject = JsonObject.create(); jsonObject.put(name, value); Document document = new Document(); document.append(name, value); ODocument document = new ODocument(“collection”); document.field(name, value);
  17. 17. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima A first attempt on independence… Logic DAO JPA — Hibernate OGM — Eclipse TopLink
  18. 18. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima … brings a bunch of issues! — Can’t save asynchronously ◦ No callback — Can’t define aTime to Live (TTL) for stored data — Consistency Level choice on persist — Not all DBs are SQL-based — There are many NoSQL types
  19. 19. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima JNoSQL
  20. 20. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima What is JNoSQL? — Mapping API - Artemis — Communication API - Diana — No lock-in — Divide and conquer DAO Communication Mapping JNoSQL
  21. 21. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Eclipse JNoSQL — Eclipse Foundation — Apache v2 + EPL 1.0 — API to each NoSQL type — Configurable — Extensible Communication Mapping
  22. 22. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima JNoSQL - Diana — Communication layer API — One API for each DB type ◦ Document ◦ Key-value ◦ Column ◦ Graph
  23. 23. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima JNoSQL – Diana APIs Key/Value Document Column Family Graph
  24. 24. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Back to that Document DB… DocumentEntity entity = DocumentEntity.of("documentCollection"); Document document = Document.of(name, value); entity.add(document);
  25. 25. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Names & Definitions — Configuration — Factory — Manager — Entity
  26. 26. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Names & Definitions ColumnConfiguration<?> condition = new DriverConfiguration(); try(ColumnFamilyManagerFactory managerFactory = condition.get()) { ColumnFamilyManager entityManager = managerFactory.get(KEY_SPACE); entityManager.insert(entity); ColumnQuery select = select().from(COLUMN_FAMILY).where(eq(id)).build(); ColumnDeleteQuery delete = delete().from(COLUMN_FAMILY) .where(eq(id)).build(); Optional<ColumnEntity> result = entityManager.singleResult(query); entityManager.delete(delete); }
  27. 27. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Handling diversity (1) ColumnEntity entity = ColumnEntity.of(COLUMN_FAMILY); Column id = Column.of("id", 10L); entity.add(id); entity.add(Column.of("version", 0.001)); entity.add(Column.of("name", "Diana")); entity.add(Column.of("options",Arrays.asList(1, 2, 3)));
  28. 28. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Handling diversity (2) //mutiple implementation entityManager.insert(entity); ColumnQuery query = select().from(COLUMN_FAMILY).where(ColumnCondition.eq(id)).build(); Optional<ColumnEntity> result = entityManager.singleResult(query); //cassandra only List<ColumnEntity> entities = entityManagerCassandra .cql("select * from newKeySpace.newColumnFamily where id=10;"); entityManagerCassandra.insert(entity, ConsistencyLevel.ALL);
  29. 29. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima JNoSQL - Artemis — Based on CDI and Diana — Heavy use of Annotations — Events on Create, Update, Delete — BeanValidation Support — Configurable and Extensible — “Query by Methods”
  30. 30. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Names & Definitions — Annotated Entities — Template — Repository — Configuration
  31. 31. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Annotaded Entities — MappedSuperclass — Entity — Column @Entity(”god") public class God { @Column private String name; @Column private Set<God> siblings; … }
  32. 32. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Template import static DocumentQuery.select; @Inject DocumentTemplate template; God diana = God.builder().withName(“Diana”); template.insert(diana); template.update(diana); DocumentQuery query = select().from(“god”).where(“name”).equals(“Diana”).build(); List<God> gods = template.select(query);
  33. 33. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Repository @Inject @Database(DatabaseType.COLUMN) private GodRepository godRepository; @Inject @Database(DatabaseType.KEY_VALUE) private GodRepository godRepository;
  34. 34. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Configuration [ { "description": "The couchbase document configuration", "name": "document", "provider": "org.jnosql.diana.couchbase.document.CouchbaseDocumentConfiguration", "settings": { "couchbase-host-1": "localhost", "couchbase-user": "root", "couchbase-password": "123456" } } ]
  35. 35. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Configuration @Inject @ConfigurationUnit private DocumentCollectionManagerFactory<?> entityManager;
  36. 36. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Expansibility @Entity("person") public class God { @Column private String name; @UDT(”weapon") @Column private Weapon weapon; }
  37. 37. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Expansibility interface GodRepository extends CassandraRepository<God> { @CQL("select * from Person") List<Person> findAll(); @CQL("select * from Person where name = ?") List<Person> findByName(String name); }
  38. 38. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima JNoSQL Community
  39. 39. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima NoSQL Vendors & Providers
  40. 40. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima JUGs & other communities
  41. 41. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Website http://jnosql.org
  42. 42. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Mailing List https://dev.eclipse.org/mailman/listinfo/jnosql-dev
  43. 43. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Repository https://github.com/JNOSQL/
  44. 44. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Gitter https://gitter.im/JNOSQL/developers
  45. 45. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Wiki https://wiki.eclipse.org/JNoSQL
  46. 46. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima ? & !
  47. 47. JNoSQL #JavaOne #JNoSQL @JNoSQL @otaviojava @leomrlima Thanks!

×