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.

Eclipse JNoSQL: One API to Many NoSQL Databases - BYOL [HOL5998]

Eclipse JNoSQL is a Java framework that streamlines the integration of Java applications with NoSQL databases. It defines a set of APIs and provides a standard implementation for most NoSQL databases. This clearly helps achieve very low coupling with the underlying NoSQL technologies used in applications. The objective of this session is to show how to use the Eclipse JNoSQL framework to connect with a NoSQL database and perform operations to manipulate and extract information.

  • Login to see the comments

Eclipse JNoSQL: One API to Many NoSQL Databases - BYOL [HOL5998]

  1. 1. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Eclipse JNoSQL One API to Many NoSQL Databases Otávio SantanaLeonardo LimaJonathan Vila Lopez Hillmer Chona Patricia Uribe
  2. 2. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Hillmer Chona Medellin JUG Leader Catholic University Luis Amigó - Colombia Oracle Groundbreaker ambassador About the Speakers
  3. 3. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Jonathan Vila Lopez Software developer for the last 25 years in different languages Works for RedHat Leader of Barcelona Java Users Group and JBCNConf Very passionate about Java Interested in particular on OSGi, Kubernetes, VR About the Speakers
  4. 4. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona About the Speakers Leonardo Lima Computer engineer, server & embedded sw developer CTO at V2COM Spec Lead – JSR363 – Units of Measurement V2COM’s Representative at JCP Executive Committee
  5. 5. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Otávio Santana Software engineer, Tomitribe 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
  6. 6. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Patricia Uribe Medellin JUG Leader Catholic University Luis Amigó - Colombia About the Speakers
  7. 7. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona NoSQL (Not Only SQL)
  8. 8. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona 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
  9. 9. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Key/Value ● AmazonDynamo ● AmazonS3 ● Redis ● Scalaris ● Voldemort ● Couchbase ● Hazelcast Apollo Sun Aphrodite Love Ares War Light Music Beauty
  10. 10. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Row key Column Family ● Hbase ● Cassandra ● Scylla ● Clouddata ● SimpleDb ● DynamoDB Apollo Ares Kratos Duty {”Sun”, “Light”, ”Music”} Duty “War” SlainGods 13 Weapon “Sword”
  11. 11. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Document ● AmazonSimpleD ● Apache CouchDB ● Couchbase ● MongoDB ● Riak { ”name”:”Diana”, ”father”:”Jupiter”, ”mother”:”Latona”, ”siblings”:{ ”name”: ”Apollo” }, ”godOf”: {”Hunt”} }
  12. 12. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Graph ● Neo4J ● InfoGrid ● Sones ● HyperGraphDB Apollo Ares Kratos sibling slew slew slain by slain by
  13. 13. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Multi-model ● OrientDB ◦ graph, document ● Couchbase ◦ key-value, document ● Elasticsearch ◦ document, graph ● ArangoDB ◦ column family, graph, key-value
  14. 14. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona 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
  15. 15. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Scalability x Complexity Scalability Complexity Key/Value Document Column Family Graph
  16. 16. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona JNoSQL
  17. 17. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona What is JNoSQL? ● Mapping API - Artemis ● Communication API - Diana ● No lock-in ● Divide and conquer DAO Communication Mapping JNoSQL
  18. 18. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Eclipse JNoSQL ● Eclipse Foundation ● Apache v2 + EPL 1.0 ● API to each NoSQL type ● Configurable ● Extensible Communication Mapping
  19. 19. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona 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);
  20. 20. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona … now with JNoSQL DocumentEntity entity = DocumentEntity.of("documentCollection"); Document document = Document.of(name, value); entity.add(document);
  21. 21. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Names & Definitions ● Configuration ● Factory ● Manager ● Entity
  22. 22. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona 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); }
  23. 23. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Eclipse JNoSQL - Artemis ● Based on CDI and Diana ● Heavy use of Annotations ● Events on Create, Update, Delete ● Bean Validation Support ● Configurable and Extensible ● “Query by Methods”
  24. 24. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Names & Definitions ● Annotated Entities ● Template ● Repository ● Configuration
  25. 25. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Annotaded Entities ● MappedSuperclass ● Entity ● Column @Entity(”god") public class God { @Column private String name; @Column private Set<God> siblings; … }
  26. 26. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Templates import static; @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 =;
  27. 27. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Repository @Inject @Database(DatabaseType.COLUMN) private GodRepository godRepository; @Inject @Database(DatabaseType.KEY_VALUE) private GodRepository godRepository;
  28. 28. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona 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" } } ]
  29. 29. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Configuration @Inject @ConfigurationUnit private DocumentCollectionManagerFactory<?> entityManager;
  30. 30. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Hands-On!
  31. 31. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Data model for the use cases JUG • Name • City • Programming Languages • Country JUGs and JUG Members! JUG Member • Name • City • Programming Languages (name and skill level)
  32. 32. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Use case #1 - Key/Value Create a database to handle JUG information using Redis • Create, Retrieve and Update JUG information • Model once and reuse the model with different database
  33. 33. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Use case #2 - Document Implement some searches against a MongoDB • Search JUG members in a given city • Search JUG members of legal drinking age • Search JUGs in a region
  34. 34. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Use case #3 - Graph Implement recommendation searches against Neo4J • Find Beginner Java Users that know Advanced Java User(s). • Find Java Users in a given City • Recommend Advanced Java Users in the same City as a given User.
  35. 35. JNoSQL #CodeOne #JNoSQL @JNoSQL @HillmerCh@leomrlima @otaviojava @patricia_uz @vilojona Thanks!