SlideShare une entreprise Scribd logo
1  sur  28
How to Use NoSQL
in Enterprise Java Applications




Patrick Baumgartner

NoSQL Roadshow | Basel | 30.08.2012
Agenda

•   Speaker Profile
•   New Demands on Data Access
•   New Types of Data Stores
•   Integrating NoSQL Data Stores
•   Spring Data Overview
•   Example with MongoDB
•   Example with Neo4j
•   Q&A




                                    2
Speaker Profile

Patrick Baumgartner
•   Senior Software Consultant | Partner
•   VMware/SpringSource Certified Instructor (Spring Trainer)
•   Spring Framework, OSGi & agile engineering practices
•   Co-author of „OSGi für Praktiker“ (Hanser)


Swiftmind GmbH http://www.swiftmind.com
• Enterprise Java, Spring & OSGi consulting
• Spring & OSGi workshops & trainings
• Agile engineering practices workshops


                                                                3
New Demands on Data Access

                  • Structured and
                    unstructured data
                  • Massive amounts of data
                  • Inexpensive horizontal
                    scaling
                  • Apps and data in the
                    cloud
                  • Social network features
                  • …




                                              4
New Types of Data Stores




                           5
Integrating NoSQL Data Stores #1
We are not architects!




                            http://www.flickr.com/photos/sakeeb/4087246274


                                                                        6
Integrating NoSQL Data Stores #2
Don’t re-invent the wheel!




                             http://www.flickr.com/photos/dmott9/5921728819


                                                                         7
Integrating NoSQL Data Stores #3
Let’s use Spring!




                              http://www.springsource.org/spring-data


                                                                   8
Spring Data

• Same goals as the Spring Framework
   – Productivity improvement
   – Programming model consistency
   – Portability

• Umbrella for subprojects, specific to a given database
• Mapping support for Java domain objects



• http://www.springsource.org/spring-data
• http://github.com/SpringSource/spring-data-XXX

                                                           9
Spring Data – Overview #1

  Relational Databases
  • JPA
  • JDBC Extensions

  Big Data
  • Apache Hadoop

  Data Grid
  • GemFire

  HTTP
  • REST

                            10
Spring Data – Overview #2

  Key Value Stores
  • Redis

  Document Stores
  • Mongo DB

  Graph Databases
  • Neo4J

  Column Stores
  • HBase

  Common Infrastructure
  • Commons

                            11
Spring Data – Key Features

• Low level data access API abstraction
   – MongoTemplate, RiakTemplate, Neo4jTemplate
   – Exception translation
   – Transaction management
• Object Mapping (Java to data store)
• Generic Repository Support
   – Basic CRUD, dynamic finders, pagination and sorting
• Spring namespaces
• Cross Store Persistence Programming Model
   – @Entity, @Document, @NodeEntity



                                                           12
Spring Data MongoDB – Example




                                13
Documents



            Stored JSON:
            { "_id" : ObjectId("4f9886290364b533b3acd4ce"),
              "_class" : "com.acme.hello.domain.Person",
              "name" : "Bob",
              "age" : 33
            }




                                                         14
Spring Data MongoDB – Document

@Document
public class Person {
  @Id
                         Stored JSON:
  private int id;        { "_id" : ObjectId("4f9886290364b533b3acd4ce"),
                           "_class" : "com.example.Person",
  private String name;     "name" : "Bob",
  private int age;         "age" : 33
                         }
  // getters/setters…
}




                                                                      15
Spring Data MongoDB – Configuration




                                      16
Spring Data MongoDB – Repository

@Repository
public class MongoPersonRepository implements BaseRepository<Person> {


    @Autowired
    MongoOperations mongoTemplate;


    Person createPerson(String name, int age){
        if(!mongoTemplate.collectionExists(Person.class)){
            mongoTemplate.createCollection(Person.class);
        }
        Person p = new Person(name, age);
        mongoTemplate.insert(p)
        return p;
    }


    ...
}



                                                                         17
Spring Data Neo4j – Example




                              18
Graph




        19
Spring Data Neo4j (SDN)

•   POJOs mapped as nodes or relationships – type safe
•   Works directly Database, typically embedded mode
•   Data is fetched very fast and lazy
•   Stores everything within a @Transaction
•   Uses heavily AspectJ magic to enhance the POJOs
•   …




                                                         20
Spring Data Neo4j – Entity

@NodeEntity
                                 Node
public class Person {
  private String name;
  private int age;             _type_: com.example.Person
                               name: "Alice"
  // getters/setters…          age: 42

}

Person alice = new Person();
alice.setName("Alice");
alice.setAge(42);
alice.persist();

                                                            21
Spring Data Neo4j – NodeEntity

@NodeEntity
public class Person {
  private String name;
  private int yearOfBirth;
  @RelatedTo(type = "KNOWS", direction = Direction.OUTGOING)
  private Set<Person> knownPersons;

 public void knows(Person p) {
   knownPersons.add(p);
 }
 public Set<Person> getFriends() {                   KNOWS
   return knownPersons;                   Alice                    Bob
 }
}
Person alice = ...;
alice.knows(bob);
alice.knows(carol);                          KNOWS
                                                               Carol


                                                                         22
Spring Data Neo4j – Relationship

@RelationshipEntity
public class Knows {
  private int sinceYear;
  public Knows since(int year) {
    this.sinceYear = year;
    return this;
  }
}

@NodeEntity
public class Person {
  public Known knows(Person p) {
    return this.relateTo(p, Knows.class, "KNOWS");
  }
}
Person alice = ...;
Person bob ...;                                      KNOWS
alice.knows(bob).since(2012);         Alice                        Bob
                                                     since: 2012

                                                                     23
Spring Data Neo4j – Repository

public interface PersonRepository extends
GraphRepository<Person> {
    @Query("start person = {0} match ... return ...")
    Iterable<Product> getOwnedServices(Person person);
    Iterable<Person> findByName(String name);
    Iterable<Person> findByNameLike(String name);
}


@Autowired
PersonRepository personRepository;
Person alice = personRepository.findByName("Alice");



                                                         24
Spring Data Neo4j – Querying

• Several possibilities implemented to query the graph
   – Neo4j API
   – Traversal descriptions
   – Graph algorithms
   – Index queries
   – Cypher queries




                                                         25
Give it a try!
Use a data model which really matches to your data …




                                           http://www.flickr.com/photos/juniorvelo/3267647833


                                                                                         26
05.09.2012 /ch/open Workshop-Tage
NoSQL für Java Enterprise Anwendungen mit Spring Data




                                         4th – 6th September



                                          http://www.flickr.com/photos/4nitsirk/5211251578


                                                                                      27
Q&A




Patrick Baumgartner
patrick.baumgartner [at] swiftmind [dot] com
http://www.swiftmind.com http://www.twitter.com/patbaumgartner


                                                            28

Contenu connexe

Tendances

Cross-Platform Mobile Apps & Drupal Web Services
Cross-Platform Mobile Apps & Drupal Web ServicesCross-Platform Mobile Apps & Drupal Web Services
Cross-Platform Mobile Apps & Drupal Web ServicesBob Sims
 
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramSession 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramFIWARE
 
Contextual Computing - Knowledge Graphs & Web of Entities
Contextual Computing - Knowledge Graphs & Web of EntitiesContextual Computing - Knowledge Graphs & Web of Entities
Contextual Computing - Knowledge Graphs & Web of EntitiesRichard Wallis
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017Gregg Kellogg
 
Knowledge discoverylaurahollink
Knowledge discoverylaurahollinkKnowledge discoverylaurahollink
Knowledge discoverylaurahollinkSSSW
 
Neo4j Introduction (for Techies)
Neo4j Introduction (for Techies)Neo4j Introduction (for Techies)
Neo4j Introduction (for Techies)Patrick Baumgartner
 
A general introduction to Spring Data / Neo4J
A general introduction to Spring Data / Neo4JA general introduction to Spring Data / Neo4J
A general introduction to Spring Data / Neo4JFlorent Biville
 
The Web of Data is Our Opportunity
The Web of Data is Our OpportunityThe Web of Data is Our Opportunity
The Web of Data is Our OpportunityRichard Wallis
 
Introduction to BioHackathon 2014
Introduction to BioHackathon 2014Introduction to BioHackathon 2014
Introduction to BioHackathon 2014Toshiaki Katayama
 
Identifying The Benefit of Linked Data
Identifying The Benefit of Linked DataIdentifying The Benefit of Linked Data
Identifying The Benefit of Linked DataRichard Wallis
 
dataviz on d3.js + elasticsearch
dataviz on d3.js + elasticsearchdataviz on d3.js + elasticsearch
dataviz on d3.js + elasticsearchMathieu Elie
 
Back to Basics Webinar 3: Schema Design Thinking in Documents
 Back to Basics Webinar 3: Schema Design Thinking in Documents Back to Basics Webinar 3: Schema Design Thinking in Documents
Back to Basics Webinar 3: Schema Design Thinking in DocumentsMongoDB
 
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)MongoDB
 
Session 5 - NGSI-LD Advanced Operations | Train the Trainers Program
Session 5 -  NGSI-LD Advanced Operations | Train the Trainers ProgramSession 5 -  NGSI-LD Advanced Operations | Train the Trainers Program
Session 5 - NGSI-LD Advanced Operations | Train the Trainers ProgramFIWARE
 
The nature.com ontologies portal: nature.com/ontologies
The nature.com ontologies portal: nature.com/ontologiesThe nature.com ontologies portal: nature.com/ontologies
The nature.com ontologies portal: nature.com/ontologiesTony Hammond
 
Choosing the right NOSQL database
Choosing the right NOSQL databaseChoosing the right NOSQL database
Choosing the right NOSQL databaseTobias Lindaaker
 
Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeSpyros Passas
 
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...Michele Pasin
 

Tendances (20)

Cross-Platform Mobile Apps & Drupal Web Services
Cross-Platform Mobile Apps & Drupal Web ServicesCross-Platform Mobile Apps & Drupal Web Services
Cross-Platform Mobile Apps & Drupal Web Services
 
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramSession 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
 
Danbri Drupalcon Export
Danbri Drupalcon ExportDanbri Drupalcon Export
Danbri Drupalcon Export
 
Contextual Computing - Knowledge Graphs & Web of Entities
Contextual Computing - Knowledge Graphs & Web of EntitiesContextual Computing - Knowledge Graphs & Web of Entities
Contextual Computing - Knowledge Graphs & Web of Entities
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017
 
Knowledge discoverylaurahollink
Knowledge discoverylaurahollinkKnowledge discoverylaurahollink
Knowledge discoverylaurahollink
 
Neo4j Introduction (for Techies)
Neo4j Introduction (for Techies)Neo4j Introduction (for Techies)
Neo4j Introduction (for Techies)
 
A general introduction to Spring Data / Neo4J
A general introduction to Spring Data / Neo4JA general introduction to Spring Data / Neo4J
A general introduction to Spring Data / Neo4J
 
The Web of Data is Our Opportunity
The Web of Data is Our OpportunityThe Web of Data is Our Opportunity
The Web of Data is Our Opportunity
 
Introduction to BioHackathon 2014
Introduction to BioHackathon 2014Introduction to BioHackathon 2014
Introduction to BioHackathon 2014
 
Identifying The Benefit of Linked Data
Identifying The Benefit of Linked DataIdentifying The Benefit of Linked Data
Identifying The Benefit of Linked Data
 
dataviz on d3.js + elasticsearch
dataviz on d3.js + elasticsearchdataviz on d3.js + elasticsearch
dataviz on d3.js + elasticsearch
 
Back to Basics Webinar 3: Schema Design Thinking in Documents
 Back to Basics Webinar 3: Schema Design Thinking in Documents Back to Basics Webinar 3: Schema Design Thinking in Documents
Back to Basics Webinar 3: Schema Design Thinking in Documents
 
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
MongoDB Schema Design (Richard Kreuter's Mongo Berlin preso)
 
Session 5 - NGSI-LD Advanced Operations | Train the Trainers Program
Session 5 -  NGSI-LD Advanced Operations | Train the Trainers ProgramSession 5 -  NGSI-LD Advanced Operations | Train the Trainers Program
Session 5 - NGSI-LD Advanced Operations | Train the Trainers Program
 
The nature.com ontologies portal: nature.com/ontologies
The nature.com ontologies portal: nature.com/ontologiesThe nature.com ontologies portal: nature.com/ontologies
The nature.com ontologies portal: nature.com/ontologies
 
Swoogle
SwoogleSwoogle
Swoogle
 
Choosing the right NOSQL database
Choosing the right NOSQL databaseChoosing the right NOSQL database
Choosing the right NOSQL database
 
Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappe
 
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
 

Similaire à How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Basel

How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Zurich
How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow ZurichHow to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Zurich
How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow ZurichPatrick Baumgartner
 
Combine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklCombine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklNeo4j
 
Spring Up Your Graph
Spring Up Your GraphSpring Up Your Graph
Spring Up Your GraphVMware Tanzu
 
Polyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jPolyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jCorie Pollock
 
Introduction to Graph databases and Neo4j (by Stefan Armbruster)
Introduction to Graph databases and Neo4j (by Stefan Armbruster)Introduction to Graph databases and Neo4j (by Stefan Armbruster)
Introduction to Graph databases and Neo4j (by Stefan Armbruster)barcelonajug
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring DataEric Bottard
 
using Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundryusing Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud FoundryJoshua Long
 
MongoDB + Java + Spring Data
MongoDB + Java + Spring DataMongoDB + Java + Spring Data
MongoDB + Java + Spring DataAnton Sulzhenko
 
MongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseMongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseGaurav Awasthi
 
springdatajpatwjug-120527215242-phpapp02.pdf
springdatajpatwjug-120527215242-phpapp02.pdfspringdatajpatwjug-120527215242-phpapp02.pdf
springdatajpatwjug-120527215242-phpapp02.pdfssuser0562f1
 
Data Abstraction for Large Web Applications
Data Abstraction for Large Web ApplicationsData Abstraction for Large Web Applications
Data Abstraction for Large Web Applicationsbrandonsavage
 
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...Spark Summit
 
Linked Open Data Utrecht University Library
Linked Open Data Utrecht University LibraryLinked Open Data Utrecht University Library
Linked Open Data Utrecht University LibraryRuben Schalk
 
Considerations for using NoSQL technology on your next IT project - Akmal Cha...
Considerations for using NoSQL technology on your next IT project - Akmal Cha...Considerations for using NoSQL technology on your next IT project - Akmal Cha...
Considerations for using NoSQL technology on your next IT project - Akmal Cha...jaxconf
 
Core Data Migrations and A Better Option
Core Data Migrations and A Better OptionCore Data Migrations and A Better Option
Core Data Migrations and A Better OptionPriya Rajagopal
 
Searching Relational Data with Elasticsearch
Searching Relational Data with ElasticsearchSearching Relational Data with Elasticsearch
Searching Relational Data with Elasticsearchsirensolutions
 
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016ICS User Group
 

Similaire à How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Basel (20)

How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Zurich
How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow ZurichHow to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Zurich
How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Zurich
 
Combine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklCombine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quickl
 
Spring Up Your Graph
Spring Up Your GraphSpring Up Your Graph
Spring Up Your Graph
 
Polyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jPolyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4j
 
Introduction to Graph databases and Neo4j (by Stefan Armbruster)
Introduction to Graph databases and Neo4j (by Stefan Armbruster)Introduction to Graph databases and Neo4j (by Stefan Armbruster)
Introduction to Graph databases and Neo4j (by Stefan Armbruster)
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring Data
 
Analyse Yourself
Analyse YourselfAnalyse Yourself
Analyse Yourself
 
using Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundryusing Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundry
 
MongoDB + Java + Spring Data
MongoDB + Java + Spring DataMongoDB + Java + Spring Data
MongoDB + Java + Spring Data
 
SQL vs NoSQL
SQL vs NoSQLSQL vs NoSQL
SQL vs NoSQL
 
Neo4j_allHands_04112013
Neo4j_allHands_04112013Neo4j_allHands_04112013
Neo4j_allHands_04112013
 
MongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL DatabaseMongoDB - An Agile NoSQL Database
MongoDB - An Agile NoSQL Database
 
springdatajpatwjug-120527215242-phpapp02.pdf
springdatajpatwjug-120527215242-phpapp02.pdfspringdatajpatwjug-120527215242-phpapp02.pdf
springdatajpatwjug-120527215242-phpapp02.pdf
 
Data Abstraction for Large Web Applications
Data Abstraction for Large Web ApplicationsData Abstraction for Large Web Applications
Data Abstraction for Large Web Applications
 
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...
Building a Dataset Search Engine with Spark and Elasticsearch: Spark Summit E...
 
Linked Open Data Utrecht University Library
Linked Open Data Utrecht University LibraryLinked Open Data Utrecht University Library
Linked Open Data Utrecht University Library
 
Considerations for using NoSQL technology on your next IT project - Akmal Cha...
Considerations for using NoSQL technology on your next IT project - Akmal Cha...Considerations for using NoSQL technology on your next IT project - Akmal Cha...
Considerations for using NoSQL technology on your next IT project - Akmal Cha...
 
Core Data Migrations and A Better Option
Core Data Migrations and A Better OptionCore Data Migrations and A Better Option
Core Data Migrations and A Better Option
 
Searching Relational Data with Elasticsearch
Searching Relational Data with ElasticsearchSearching Relational Data with Elasticsearch
Searching Relational Data with Elasticsearch
 
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
Find your data - using GraphDB capabilities in XPages applications - ICS.UG 2016
 

Plus de Patrick Baumgartner

Daten natuerlich modellieren und verarbeiten mit Neo4j
Daten natuerlich modellieren und verarbeiten mit Neo4jDaten natuerlich modellieren und verarbeiten mit Neo4j
Daten natuerlich modellieren und verarbeiten mit Neo4jPatrick Baumgartner
 
BED-Con - Tools für den täglichen Kampf als Entwickler
BED-Con - Tools für den täglichen Kampf als EntwicklerBED-Con - Tools für den täglichen Kampf als Entwickler
BED-Con - Tools für den täglichen Kampf als EntwicklerPatrick Baumgartner
 
JFS 2011 - Top 10 Tools & Methoden - Baumgartner, Oehmichen
JFS 2011 - Top 10 Tools & Methoden - Baumgartner, OehmichenJFS 2011 - Top 10 Tools & Methoden - Baumgartner, Oehmichen
JFS 2011 - Top 10 Tools & Methoden - Baumgartner, OehmichenPatrick Baumgartner
 
OSGi für Praktiker - Web Applikationen und verteilte Systeme mit OSGi
OSGi für Praktiker - Web Applikationen und verteilte Systeme mit OSGiOSGi für Praktiker - Web Applikationen und verteilte Systeme mit OSGi
OSGi für Praktiker - Web Applikationen und verteilte Systeme mit OSGiPatrick Baumgartner
 
Pax – Tools für den OSGi Alltag
Pax – Tools für den OSGi AlltagPax – Tools für den OSGi Alltag
Pax – Tools für den OSGi AlltagPatrick Baumgartner
 

Plus de Patrick Baumgartner (8)

Customer is king
Customer is kingCustomer is king
Customer is king
 
Daten natuerlich modellieren und verarbeiten mit Neo4j
Daten natuerlich modellieren und verarbeiten mit Neo4jDaten natuerlich modellieren und verarbeiten mit Neo4j
Daten natuerlich modellieren und verarbeiten mit Neo4j
 
BED-Con - Tools für den täglichen Kampf als Entwickler
BED-Con - Tools für den täglichen Kampf als EntwicklerBED-Con - Tools für den täglichen Kampf als Entwickler
BED-Con - Tools für den täglichen Kampf als Entwickler
 
JFS 2011 - Top 10 Tools & Methoden - Baumgartner, Oehmichen
JFS 2011 - Top 10 Tools & Methoden - Baumgartner, OehmichenJFS 2011 - Top 10 Tools & Methoden - Baumgartner, Oehmichen
JFS 2011 - Top 10 Tools & Methoden - Baumgartner, Oehmichen
 
OSGi für Praktiker - Web Applikationen und verteilte Systeme mit OSGi
OSGi für Praktiker - Web Applikationen und verteilte Systeme mit OSGiOSGi für Praktiker - Web Applikationen und verteilte Systeme mit OSGi
OSGi für Praktiker - Web Applikationen und verteilte Systeme mit OSGi
 
Pax – Tools für den OSGi Alltag
Pax – Tools für den OSGi AlltagPax – Tools für den OSGi Alltag
Pax – Tools für den OSGi Alltag
 
OSGi with the Spring Framework
OSGi with the Spring FrameworkOSGi with the Spring Framework
OSGi with the Spring Framework
 
Whats New In Spring 3.0 ?
Whats New In Spring 3.0 ?Whats New In Spring 3.0 ?
Whats New In Spring 3.0 ?
 

Dernier

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Dernier (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

How to use NoSQL in Enterprise Java Applications - NoSQL Roadshow Basel

  • 1. How to Use NoSQL in Enterprise Java Applications Patrick Baumgartner NoSQL Roadshow | Basel | 30.08.2012
  • 2. Agenda • Speaker Profile • New Demands on Data Access • New Types of Data Stores • Integrating NoSQL Data Stores • Spring Data Overview • Example with MongoDB • Example with Neo4j • Q&A 2
  • 3. Speaker Profile Patrick Baumgartner • Senior Software Consultant | Partner • VMware/SpringSource Certified Instructor (Spring Trainer) • Spring Framework, OSGi & agile engineering practices • Co-author of „OSGi für Praktiker“ (Hanser) Swiftmind GmbH http://www.swiftmind.com • Enterprise Java, Spring & OSGi consulting • Spring & OSGi workshops & trainings • Agile engineering practices workshops 3
  • 4. New Demands on Data Access • Structured and unstructured data • Massive amounts of data • Inexpensive horizontal scaling • Apps and data in the cloud • Social network features • … 4
  • 5. New Types of Data Stores 5
  • 6. Integrating NoSQL Data Stores #1 We are not architects! http://www.flickr.com/photos/sakeeb/4087246274 6
  • 7. Integrating NoSQL Data Stores #2 Don’t re-invent the wheel! http://www.flickr.com/photos/dmott9/5921728819 7
  • 8. Integrating NoSQL Data Stores #3 Let’s use Spring! http://www.springsource.org/spring-data 8
  • 9. Spring Data • Same goals as the Spring Framework – Productivity improvement – Programming model consistency – Portability • Umbrella for subprojects, specific to a given database • Mapping support for Java domain objects • http://www.springsource.org/spring-data • http://github.com/SpringSource/spring-data-XXX 9
  • 10. Spring Data – Overview #1 Relational Databases • JPA • JDBC Extensions Big Data • Apache Hadoop Data Grid • GemFire HTTP • REST 10
  • 11. Spring Data – Overview #2 Key Value Stores • Redis Document Stores • Mongo DB Graph Databases • Neo4J Column Stores • HBase Common Infrastructure • Commons 11
  • 12. Spring Data – Key Features • Low level data access API abstraction – MongoTemplate, RiakTemplate, Neo4jTemplate – Exception translation – Transaction management • Object Mapping (Java to data store) • Generic Repository Support – Basic CRUD, dynamic finders, pagination and sorting • Spring namespaces • Cross Store Persistence Programming Model – @Entity, @Document, @NodeEntity 12
  • 13. Spring Data MongoDB – Example 13
  • 14. Documents Stored JSON: { "_id" : ObjectId("4f9886290364b533b3acd4ce"), "_class" : "com.acme.hello.domain.Person", "name" : "Bob", "age" : 33 } 14
  • 15. Spring Data MongoDB – Document @Document public class Person { @Id Stored JSON: private int id; { "_id" : ObjectId("4f9886290364b533b3acd4ce"), "_class" : "com.example.Person", private String name; "name" : "Bob", private int age; "age" : 33 } // getters/setters… } 15
  • 16. Spring Data MongoDB – Configuration 16
  • 17. Spring Data MongoDB – Repository @Repository public class MongoPersonRepository implements BaseRepository<Person> { @Autowired MongoOperations mongoTemplate; Person createPerson(String name, int age){ if(!mongoTemplate.collectionExists(Person.class)){ mongoTemplate.createCollection(Person.class); } Person p = new Person(name, age); mongoTemplate.insert(p) return p; } ... } 17
  • 18. Spring Data Neo4j – Example 18
  • 19. Graph 19
  • 20. Spring Data Neo4j (SDN) • POJOs mapped as nodes or relationships – type safe • Works directly Database, typically embedded mode • Data is fetched very fast and lazy • Stores everything within a @Transaction • Uses heavily AspectJ magic to enhance the POJOs • … 20
  • 21. Spring Data Neo4j – Entity @NodeEntity Node public class Person { private String name; private int age; _type_: com.example.Person name: "Alice" // getters/setters… age: 42 } Person alice = new Person(); alice.setName("Alice"); alice.setAge(42); alice.persist(); 21
  • 22. Spring Data Neo4j – NodeEntity @NodeEntity public class Person { private String name; private int yearOfBirth; @RelatedTo(type = "KNOWS", direction = Direction.OUTGOING) private Set<Person> knownPersons; public void knows(Person p) { knownPersons.add(p); } public Set<Person> getFriends() { KNOWS return knownPersons; Alice Bob } } Person alice = ...; alice.knows(bob); alice.knows(carol); KNOWS Carol 22
  • 23. Spring Data Neo4j – Relationship @RelationshipEntity public class Knows { private int sinceYear; public Knows since(int year) { this.sinceYear = year; return this; } } @NodeEntity public class Person { public Known knows(Person p) { return this.relateTo(p, Knows.class, "KNOWS"); } } Person alice = ...; Person bob ...; KNOWS alice.knows(bob).since(2012); Alice Bob since: 2012 23
  • 24. Spring Data Neo4j – Repository public interface PersonRepository extends GraphRepository<Person> { @Query("start person = {0} match ... return ...") Iterable<Product> getOwnedServices(Person person); Iterable<Person> findByName(String name); Iterable<Person> findByNameLike(String name); } @Autowired PersonRepository personRepository; Person alice = personRepository.findByName("Alice"); 24
  • 25. Spring Data Neo4j – Querying • Several possibilities implemented to query the graph – Neo4j API – Traversal descriptions – Graph algorithms – Index queries – Cypher queries 25
  • 26. Give it a try! Use a data model which really matches to your data … http://www.flickr.com/photos/juniorvelo/3267647833 26
  • 27. 05.09.2012 /ch/open Workshop-Tage NoSQL für Java Enterprise Anwendungen mit Spring Data 4th – 6th September http://www.flickr.com/photos/4nitsirk/5211251578 27
  • 28. Q&A Patrick Baumgartner patrick.baumgartner [at] swiftmind [dot] com http://www.swiftmind.com http://www.twitter.com/patbaumgartner 28

Notes de l'éditeur

  1. Spring Data repositories can be composed with interfacesThe implementation is magically provided by Spring Data