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.
Others Talk,
We Listen.
Using NoSQL with
JPA, CDI and
Java EE
Reza Rahman
Senior Architect
rrahman@captechconsulting.com
@...
CapTech
Full-service US national IT consulting firm that focuses on client best interests,
trust, servant leadership, cult...
Agenda
• NoSQL Landscape
• Using NoSQL with JPA
• Using NoSQL with CDI
Copyright © 2015 CapTech Ventures, Inc. All rights ...
NoSQL Landscape
• Non-conformance to established RDMS paradigm
• No SQL/queries, no schemas, weak referential integrity, n...
NoSQL Landscape
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Adoption and Trends
The Case for JPA
• There almost always is a domain model
• Most of JPA fits NoSQL quite well
• Learning each diverging NoS...
Applying JPA to NoSQL
• JPA domain model concepts apply well to NoSQL
• Entities, Embeddables, OneToOne, OneToMany, ManyTo...
EclipseLink NoSQL
• Support JPA style access to NoSQL databases
• Leverage existing non-relational database support
• Meta...
JPA NoSQL Demo
https://github.com/m-reza-rahman/jpa-nosql-demo
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Other JPA/NoSQL Solutions
• Hibernate OGM
• Utilizes Hibernate codebase for NoSQL
• MongoDB, Cassandra, Neo4J, CouchDB, In...
CDI Overview
• Next-generation dependency injection for Java EE
• Synthesizes best ideas from Seam 2, Guice and Spring
• M...
A Quick Look at CDI
• Basic dependency injection
• @Inject, @Qualifier, @Named, @Stereotype,
@Alternative, @Produces, @Dis...
The Case for CDI
• “Hibernate OGM is not expected to be the Rosetta stone used to interact with
all NoSQL solutions in all...
CDI NoSQL Demo
https://github.com/m-reza-rahman/cdi-nosql-demo
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Summary
• NoSQL has uses, but still immature, niche and volatile
• JPA can apply well to NoSQL – many such initiatives
• M...
Resources
• Considerations for Using NoSQL on Your Next Project
• http://www.slideshare.net/VeryFatBoy/bcs-2013
• EclipseL...
Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
Upcoming SlideShare
Loading in …5
×

Using NoSQL with JPA, CDI and Java EE

71,278 views

Published on

This session explores how NoSQL solutions like MongoDB, Cassandra, Neo4j, HBase and CouchDB can be used in a Java EE application with or without a JPA facade. Although the primary focus is on EclipseLink NoSQL, we will also cover Hibernate OGM, EasyCassandra, Morphia, etc as well as seeing how NoSQL can be used natively via basic CDI injection.

Published in: Technology

Using NoSQL with JPA, CDI and Java EE

  1. 1. Others Talk, We Listen. Using NoSQL with JPA, CDI and Java EE Reza Rahman Senior Architect rrahman@captechconsulting.com @reza_rahman
  2. 2. CapTech Full-service US national IT consulting firm that focuses on client best interests, trust, servant leadership, culture, professionalism and technical excellence. #28 in Vault's Consulting Top 50 #3 Best Consulting Internship #9 Best Overall Internship #1 in Meeting Client’s Needs #7 Best Firm to Work For #1 in Career Development Ranked for the 7th Consecutive Year Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  3. 3. Agenda • NoSQL Landscape • Using NoSQL with JPA • Using NoSQL with CDI Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  4. 4. NoSQL Landscape • Non-conformance to established RDMS paradigm • No SQL/queries, no schemas, weak referential integrity, no JOINs • Scalability and cost major motivators • ACID vs. BASE • Unstructured data minor motivator • Mostly complement and not replace relational databases • Extremely divergent, specialized products • Some taxonomies • Key/value, document, graph, etc • MongoDB, Cassandra, Google BigTable, CouchDB, HBase, Redis, Neo4j Copyright © 2015 CapTech Ventures, Inc. All rights reserved. Wild, Wild West
  5. 5. NoSQL Landscape Copyright © 2015 CapTech Ventures, Inc. All rights reserved. Adoption and Trends
  6. 6. The Case for JPA • There almost always is a domain model • Most of JPA fits NoSQL quite well • Learning each diverging NoSQL product cumbersome, often unnecessary • Switching between NoSQL solutions difficult • “Polyglot Persistence” difficult • NoSQL APIs generally low level, verbose Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  7. 7. Applying JPA to NoSQL • JPA domain model concepts apply well to NoSQL • Entities, Embeddables, OneToOne, OneToMany, ManyToOne, ManyToMany • Pure relational concepts may not apply well • Table, Column, JoinTable, JoinColumn • JPA queries can fit relatively well • Basic finders (by identity, all) • JPQL—portable query language defined by the spec • Native query—lets you leverage database specific features Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  8. 8. EclipseLink NoSQL • Support JPA style access to NoSQL databases • Leverage existing non-relational database support • Metadata to identify NoSQL entities (e.g. @NoSQL) • Support JPQL subset • Leverage what’s available • Initial support for MongoDB and Oracle NoSQL • More to come (Cassandra, HBase, CouchDB?) • Support mixing relational and non-relational data in single composite persistence unit (“polyglot persistence”) Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  9. 9. JPA NoSQL Demo https://github.com/m-reza-rahman/jpa-nosql-demo Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  10. 10. Other JPA/NoSQL Solutions • Hibernate OGM • Utilizes Hibernate codebase for NoSQL • MongoDB, Cassandra, Neo4J, CouchDB, Infinispan, Ehcache • Tries to provide as much of JPA as possible, including queries via Hibernate Search/Lucene, relational mapping annotations • DataNucleus • Persistence layer behind Google App Engine • MongoDB, Cassandra, HBase, Neo4J • Kundera • Cassandra, MongoDB, HBase, Redis, Neo4J, Oracle NoSQL, CouchDB Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  11. 11. CDI Overview • Next-generation dependency injection for Java EE • Synthesizes best ideas from Seam 2, Guice and Spring • Many innovative features on its own right • Focus on loose-coupling, Java-centric type-safety, annotations, expressiveness and ease-of-use • Large ecosystem evolving around CDI Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  12. 12. A Quick Look at CDI • Basic dependency injection • @Inject, @Qualifier, @Named, @Stereotype, @Alternative, @Produces, @Disposes • Context management • @RequestScoped, @SessionScoped, @ConversationScoped, @ApplicationScoped, @FlowScoped, @TransactionScoped • Lightweight Events • Event, @Observes • Interceptors/Decorators • @Interceptor, @Decorator • Portable Extensions SPI Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  13. 13. The Case for CDI • “Hibernate OGM is not expected to be the Rosetta stone used to interact with all NoSQL solutions in all use cases” • No real domain model • Advanced, highly specialized features • Unsupported NoSQL solutions • Existing NoSQL API knowledge • Most NoSQL APIs POJO based, easy to integrate natively via CDI Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  14. 14. CDI NoSQL Demo https://github.com/m-reza-rahman/cdi-nosql-demo Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  15. 15. Summary • NoSQL has uses, but still immature, niche and volatile • JPA can apply well to NoSQL – many such initiatives • Most NoSQL APIs are good enough to integrate directly via CDI Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  16. 16. Resources • Considerations for Using NoSQL on Your Next Project • http://www.slideshare.net/VeryFatBoy/bcs-2013 • EclipseLink NoSQL Examples • http://wiki.eclipse.org/EclipseLink/Examples/JPA/NoSQL • Hibernate OGM • http://hibernate.org/ogm/ • DataNucleus • http://www.datanucleus.org • Kundera • https://github.com/impetus-opensource/Kundera/ • CDI • http://www.cdi-spec.org Copyright © 2015 CapTech Ventures, Inc. All rights reserved.
  17. 17. Copyright © 2015 CapTech Ventures, Inc. All rights reserved.

×