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.

Using Spring Data and MongoDB with Cloud Foundry

2,787 views

Published on

Presentation delivered at MongoUK 2011

Published in: Technology
  • Be the first to comment

Using Spring Data and MongoDB with Cloud Foundry

  1. 1. Using Spring and MongoDB with Cloud Foundry Chris Harris, Architect
  2. 2. Spring Data
  3. 3. Data Access Challenge #1: Scale Horizontally
  4. 4. Data Access Challenge #2: Heterogeneous data access needs
  5. 5. New demands on data access <ul><li>... until we needed inexpensive horizontal scaling for some large web based applications ... </li></ul><ul><li>... and we needed to deploy our apps in the cloud ... </li></ul><ul><li>image courtesy of Bitcurrent </li></ul>
  6. 6. NoSQL offers several data store categories Column Key-Value Document Graph
  7. 7. Spring Framework built-in data access support <ul><li>Transaction abstractions </li></ul><ul><li>Common data access exception hierarchy </li></ul><ul><li>JDBC - JdbcTemplate </li></ul><ul><li>ORM - Hibernate, JPA support </li></ul><ul><li>OXM - Object to XML mapping </li></ul><ul><li>Serializer/Deserializer strategies (Spring 3.0) </li></ul><ul><li>Cache support (Spring 3.1) </li></ul>
  8. 8. <ul><li>Spring Data Key-value </li></ul><ul><li>Spring Data Document </li></ul><ul><li>Spring Data Graph </li></ul><ul><li>Spring Data Column </li></ul><ul><li>Spring Data Blob </li></ul><ul><li>Spring Data JPA Repository / JDBC Extensions </li></ul><ul><li>Spring Gemfire / Spring Hadoop ... </li></ul><ul><li>Grails i N c O n S e Q uentia L </li></ul>
  9. 9. Spring Data Building Blocks <ul><li>Low level data access APIs </li></ul><ul><ul><li>MongoTemplate, RedisTemplate ... </li></ul></ul><ul><li>Object Mapping (Java and GORM) </li></ul><ul><li>Cross Store Persistence Programming model </li></ul><ul><li>Generic Repository support </li></ul><ul><li>Productivity support in Roo and Grails </li></ul>
  10. 10. Spring MongoDB
  11. 11. Spring Data Document Mongo <ul><li>MongoTemplate </li></ul><ul><ul><li>MongoConverter interface for mapping Mongo documents </li></ul></ul><ul><ul><li>SimpleMongoConverter for basic POJO mapping support </li></ul></ul><ul><ul><li>Leverage Spring 3.0 TypeConverters and SpEL </li></ul></ul><ul><ul><li>Exception translation </li></ul></ul><ul><li>Advanced Mapping </li></ul><ul><ul><li>Annotation based (@Document, @Id, @DbRef) </li></ul></ul><ul><li>MongoRepository </li></ul><ul><ul><li>Built on Hades support for JPA Repositories </li></ul></ul>
  12. 12. Simple Domain Class
  13. 13. Mongo Template Direct Usage of the Mongo Template:
  14. 14. Generic Repository Interface for generic CRUD operations on a repository for a specific type
  15. 15. Paging and Sorting Repository Extends “ CrudRepository ” Usage: Paging and Sorting Repository:
  16. 16. Custom Repository Custom Repository: Keywords : Keyword Sample Logical result GreaterThan findByAgeGreaterThan(int age) {&quot;age&quot; : { &quot;$gt&quot; : age}} LessThan findByAgeLessThan(int age) {&quot;age&quot; : { &quot;$lt&quot; : age}} Between findByAgeBetween(int from, int to) {&quot;age&quot; : { &quot;$gt&quot; : from, &quot;$lt&quot; : to}} NotNull findByFirstnameNotNull() { ” firstname&quot; : {&quot; $ne&quot; : null}} Null findByFirstnameNull() { ” firstname&quot; : null} Like findByFirstnameLike(String name) &quot; firstname &quot; : firstname } ( regex ) etc….
  17. 17. Cross Store
  18. 18. JPA and MongoDB JPA “Customer” with a “ SurveyInfo ” Document
  19. 19. Using a Cross-Store Saving a Customer with a SurveryInfo Mongo Document:
  20. 20. Cloud Foundry
  21. 21. Choice of clouds Cloud Provider Interface Application Service Interface Data Services Private Clouds Public Clouds Micro Clouds .js Other Services Msg Services .COM …
  22. 22. Cloud Foundry MongoDB Demo

×