Spring Data NOSQL Support

     • Challenge
         • Proliferation of data
         • Complexity of data
         • Won’...
The Neo4j graph database

     • A graph database uses nodes, relationships and properties




     • Sweet spot: complex ...
A scenario ...
     You have a traditional web app using JPA to persist data to a
       relational database




Tuesday, ...
Existing JPA data model

                                    Restaurant                           UserAccount
            ...
Adding Neo4J graph features to the data model

                                      Restaurant                           ...
Old style Neo4j code example


                     public class Recommendation {
                         private final R...
New style Spring/Neo4j code example
                     @RelationshipEntity
                     public class Recommendat...
The social networking version




Tuesday, October 19, 2010
Generating in Spring Roo - new Neo4J Add-On




Tuesday, October 19, 2010
Conclusion

     • The goal of the Spring Data project is to provide simple
       and convenient connectivity to non-rela...
Upcoming SlideShare
Loading in...5
×

NOSQL part of the SpringOne 2GX 2010 keynote

9,595

Published on

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
9,595
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

NOSQL part of the SpringOne 2GX 2010 keynote

  1. 1. Spring Data NOSQL Support • Challenge • Proliferation of data • Complexity of data • Won’t all go into relational databases • NOSQL = Not Only SQL • Opportunity for Spring to provide solutions • Spring Data support for new data stores Column/ Tuesday, October 19, 2010
  2. 2. The Neo4j graph database • A graph database uses nodes, relationships and properties • Sweet spot: complex domains such as social networking, bioinformatics, fraud detection, master data mgm – Very high performance on complex data: traverses 1-2 MILLION hops per second 2 Tuesday, October 19, 2010
  3. 3. A scenario ... You have a traditional web app using JPA to persist data to a relational database Tuesday, October 19, 2010
  4. 4. Existing JPA data model Restaurant UserAccount @Entity @Entity public class Restaurant { @Table(name = "user_account") @Id @GeneratedValue public class UserAccount { private Long id; @Id @GeneratedValue private String name; private Long id; private String city; private String userName; private String state; private String firstName; private String zipCode; private String lastName; @Temporal(TemporalType.TIMESTAMP) private Date birthDate; @ManyToMany(cascade = CascadeType.ALL) private Set<Restaurant> favorites; Tuesday, October 19, 2010
  5. 5. Adding Neo4J graph features to the data model Restaurant UserAccount @Entity @Entity @NodeEntity(partial = true) @Table(name = "user_account") public class Restaurant { @NodeEntity(partial = true) @Id @GeneratedValue public class UserAccount { private Long id; @Id @GeneratedValue private String name; private Long id; private String city; private String userName; private String state; private String firstName; private String zipCode; private String lastName; @Temporal(TemporalType.TIMESTAMP) private Date birthDate; @ManyToMany(cascade = CascadeType.ALL) Recommendation private Set<Restaurant> favorites; @RelationshipEntity @GraphProperty public class Recommendation { String nickname; @StartNode @RelatedTo(type = "friends", private UserAccount user; elementClass = UserAccount.class) @EndNode Set<UserAccount> friends; private Restaurant restaurant; @RelatedToVia(type = "recommends", private int stars; elementClass = Recommendation.class) private String comment; Iterable<Recommendation> recommendations; Tuesday, October 19, 2010
  6. 6. Old style Neo4j code example public class Recommendation { private final Relationship underlyingRel; public Recommendation( Relationship underlyingRel ) { this.underlyingRel = underlyingRel; } public void rate(int stars, String comment) { this.underlyingRel.setProperty("stars", stars); this.underlyingRel.setProperty("comment", comment); } public int getStars() { return (Integer) this.underlyingRel.getProperty("stars"); } public String getComment() { return (String) this.underlyingRel.getProperty("comment"); } Tuesday, October 19, 2010
  7. 7. New style Spring/Neo4j code example @RelationshipEntity public class Recommendation { @StartNode private UserAccount user; @EndNode private Restaurant restaurant; private int stars; private String comment; public Recommendation() { } public void rate(int stars, String comment) { this.stars = stars; this.comment = comment; } public int getStars() { return stars; } public String getComment() { return comment; } Tuesday, October 19, 2010
  8. 8. The social networking version Tuesday, October 19, 2010
  9. 9. Generating in Spring Roo - new Neo4J Add-On Tuesday, October 19, 2010
  10. 10. Conclusion • The goal of the Spring Data project is to provide simple and convenient connectivity to non-relational databases such as Redis, Neo4j, MongoDB and Cassandra • The Neo4j datastore-graph and Roo add-on have been developed in collaboration with the Neo4j team – Already used in a commercial context • If you want to learn more, go to: – “Graph Database Persistence using Neo4J with Spring and Roo” on Friday @ 1015 am – http://wiki.neo4j.org/content/Neo4j_and_SpringOne 10 Tuesday, October 19, 2010

×