SlideShare ist ein Scribd-Unternehmen logo
1 von 44
SpringSource and MongoDB


Chris Richardson

Author of POJOs in Action
Founder of CloudFoundry.com
Chris.Richardson@SpringSource.Com
@crichardson
Presentation Goal

  How SpringSource is
   making it easier for
     Java and Grails
   developers to build
  MongoDB applications

                      Slide 2
About Chris
        •    Grew up in England and live in Oakland, CA
        •    Over 25+ years of software development
             experience including 14 years of Java
        •    Speaker at JavaOne, SpringOne, NFJS,
             JavaPolis, Spring Experience, etc.
        •    Organize the Oakland JUG and the Groovy
             Grails meetup




                   http://www.theregister.co.uk/2009/08/19/springsource_cloud_foundry/



                                                                                         Slide 3
Agenda
   Introduction to Spring
   Spring Data and MongoDB
   Introduction to Grails
   Using Grails with MongoDB




                               Slide 4
The Spring framework
   Rapid evolution
 !    Spring 1.0 – March 2004
 !    Spring 2.0 – October 2006
 !    Spring 2.5 – December 2007
 !    Spring 3.0 – December 2009
 !    …
 !    Complete backward compatibility
   De facto standard programming
   model for enterprise Java
   Two million+ developers

                                        Slide 5
The Spring framework ecosystem
Framework                         Description
Spring framework                  The foundation
Spring.NET                        .NET port of the Spring framework
Spring Security (a.k.a. Acegi)    Extensible framework providing authentication,
                                  authorization and instance-level security
Spring Web Flow                   An excellent framework for building multi-page flows

Spring Web Services               Contract-first, document–centric SOAP web services

Spring Dynamic Modules for OSGI   Deploy Spring applications on OSGI
Spring Batch                      Powerful batch processing framework
Spring Integration                Implements enterprise integration patterns
Spring BlazeDS integration        Support for Adobe BlazeDS
Spring AMQP                       AMQP messaging, i.e. RabbitMQ
Spring Gemfire                    Simplify Gemfire application development
…

                                                                               Slide 6
Spring programming model
                       Dependency Injection:
                     resolves inter-component   Benefits:
                           dependencies,        • Improved developer
                          metadata-driven       productivity
                                                • Higher quality code
                                                • Portability across
                                                application servers




                            POJO
                                                    Aspect-Oriented
                                                    Programming:
Portable Service                                    modular
Abstractions:                                       implementation of
Transactions, data                                  cross cutting
access, …                                           concerns


                                                                  Slide 7
Portable service abstractions
  Portable service
  abstractions
  insulate developer         Business
                              Logic
  from low-level
  programming                Infrastructure code




  Less code                    Spring

  Simpler code                  Transactions
                                  Security
                                Data access


  Increased
                                     …




  productivity
  Portable code        Runtime Environment



                                                   Slide 8
Spring JDBC example
@Repository
class ActorDaoImpl implements ActorDao {
                                                          SimpleJdbcTemplate hides
@Autowired                                                the low-level, messy
private SimpleJdbcTemplate simpleJdbcTemplate;            details of using JDBC

public Actor findActor(String specialty, int age) {
  String sql = "select id, first_name, last_name from T_ACTOR" +
        " where specialty = ? and age = ?";

    RowMapper<Actor> mapper = new RowMapper<Actor>() {
       public Actor mapRow(ResultSet rs, int rowNum) throws SQLException {
         Actor actor = new Actor();
         actor.setId(rs.getLong("id"));
         actor.setFirstName(rs.getString("first_name"));
         actor.setLastName(rs.getString("last_name"));
         return actor;
       }
    };

    return simpleJdbcTemplate.queryForObject(sql, mapper, specialty, age);
}


                                                                                     Slide 9
Externalized database configuration
@Configuration
public class AppConfig {
  private @Value("#{jdbcProperties.url}") String jdbcUrl;
  private @Value("#{jdbcProperties.username}") String username;
  private @Value("#{jdbcProperties.password}") String password;

    @Bean
    public SimpleJdbcTemplate jdbcTemplate() {
      return new SimpleJdbcTemplate (dataSource());
    }

    @Bean
    public DataSource dataSource() {
      return new DriverManagerDataSource(jdbcUrl, username, password);
    }
}
                                                                 Reads DB
                                                                 configuration
<context:component-scan base-package="..."/>                     from file
<util:properties id="jdbcProperties" location="…/jdbc.properties"/>



                                                                                 Slide 10
Spring DataAccessException
   Base class for
exceptions thrown by                                    DataAccess
                                                         Exception

DAOs
    Consistent exception                Concurrency
                                          Failure
                                         Exception
                                                                       ...


handling across
Hibernate, JPA, JDBC,          Optimistic
                             LockingFailure

etc.                           Exception               Pessimistic
                                                      LockingFailure
                                                        Exception

     Unchecked exception
      Extensible exception                                       CannotSerialize

mapping:                                CannotAcquire
                                        LockException
                                                                  Transaction
                                                                   Exception

SqlExceptionTranslator

                                                                                   11
Agenda
   Introduction to the Spring framework
   Spring Data and MongoDB
   Introduction to Grails
   Using Grails with MongoDB




                                    Slide 12
Spring Data Project Goals
   Bring classic Spring value propositions
   to a wide range of NoSQL databases:
 !  Productivity
 !  Programming model consistency: E.g.
    <NoSQL>Template classes
 !  “Portability”
   Many entry points to use
 !    Auto-generated repository implementations
 !    Opinionated APIs (Think JdbcTemplate)
 !    Object Mapping (Java and GORM)
 !    Cross Store Persistence Programming model
 !    Productivity support in Roo and Grails
                                           Slide 13
MongoDB API usage patterns
   Create and store Mongo singleton
   Externalized server details
   Inserts/Updates
  !  Map application POJO " DBObject
  !  mongo.getDatabase(…).getCollection(…)
  !  Partial document updates
   Queries
  !  mongo.getDatabase(…).getCollection(…)
  !  Iterate through Cursor
  !  Map DBObject " application POJO

#  Higher-level than JDBC but still repetitive,
                       …

                                             Slide 14
Spring Data - MongoDB
   MongoTemplate
   Generic repository implementation
   Querydsl integration
   Cross-store persistence




                                       Slide 15
MongoTemplate
Simplifies data         MongoTemplate              POJO $ DBObject
access            databaseName                         mapping
Translates        userId
                  Password
exceptions
                  defaultCollectionName

                  writeConcern
                  writeResultChecking
                                                     <<interface>>
                  save()                             MongoConvertor
                  insert()                       write(Object, DBObject)
                  remove()                       read(Class, DBObject)
                  updateFirst()
                  findOne()
                  find()
                  …
                                               SimpleMongo
                                        uses     Converter
                           Mongo
                                                         MongoMapping
                     (Java Driver class)
                                                           Converter

                                                              Slide 16
Example entity
public class Restaurant {
 private String id;
 private String name;
 private List<MenuItem> menuItems;

 public Restaurant() {
 }                                         public class MenuItem {
                                            private String name;
 public Restaurant(String name) {           private double price;
   this.name = name;
   …                                       public MenuItem() {
 }                                         }

public String getName() { return name; }    public MenuItem(String name,
                                                               double price) {
                                              this.name = name;
 public void setName(String name) {
                                              this.price = price;
   this.name = name;
 }                                          }

 …getters and setters…                     …getters and setters…
                                                                      Slide 17
Example data access code
@Repository
public class RestaurantRepository {

 @Autowired
 private MongoTemplate mongoTemplate;

 public static final String RESTAURANTS_COLLECTION = "restaurants2";


 public void add(Restaurant restaurant) {
   mongoTemplate.save(RESTAURANTS_COLLECTION, restaurant);
 }

public List<Restaurant> findRestaurantsByName(String restaurantName) {
   return mongoTemplate.find(RESTAURANTS_COLLECTION,
         new Query(where("name").is(restaurantName)),
         Restaurant.class);
 }


                                                                   Slide 18
Mongo document
{
    "_id" : ObjectId("4d977f55d3fe3119c904e026"),
    "menuItems" : [
         {
                "name" : "Tandoori Portobello Mushrooms",
                "price" : 5.5
         },
         {
                "name" : "Duck Curry Kerala",
                "price" : 15
         }
        ],
    "name" : "Ajanta"
}


                                                     Slide 19
Spring MongoDB Example - Config
@Configuration public class MongoDbExampleConfig {
 private @Value("#{mongoDbProperties.databaseName}") String mongoDbDatabase;
 private @Value("#{mongoDbProperties.host}") String mongoDbHost;

@Bean public Mongo mongo() throws Exception {                              Singleton
 return new Mongo(mongoDbHost);
}

 @Bean public MongoTemplate mongoTemplate(Mongo mongo) {
   return new MongoTemplate(mongo, mongoDbDatabase);
 }…


                                 <beans>
                                 <context:annotation-config/>
              External Config
                                  <context:component-scan
                                     base-package="net.chrisrichardson.mongodb.example"/>

mongodb.properties:              <util:properties id="mongoDbProperties"
                                    location="mongodb.properties"/>
databaseName=demo1
                                 </beans>
host=192.168.253.150

                                                                               Slide 20
Spring MongoDB Example Test
public class MongoDbExampleTest {

 @Autowired private RestaurantRepository restaurantRepository;

 @Test public void test() {
  Restaurant ajanta = makeAjantaRestaurant();

     restaurantRepository.add(ajanta);

     List<Restaurant> results =
           restaurantRepository.findRestaurantsByName("Ajanta");

     assertRestaurantFound(ajanta, results);
 }

 private Restaurant makeAjantaRestaurant() {
   Restaurant ajanta = new Restaurant("Ajanta");
   ajanta.add(new MenuItem("Tandoori Portobello Mushrooms", 5.50));
   ajanta.add(new MenuItem("Duck Curry Kerala", 15.00));
   return ajanta;
 }
…
                                                                      Slide 21
Update example
@Repository
public class RestaurantRepository {
  public void addMenuItem(String restaurantId,
                          MenuItem newMenuItem) {
   DBObject dbo = new BasicDBObject();
   mongoTemplate.getConverter().write(newMenuItem, dbo);

    mongoTemplate.updateFirst(RESTAURANTS_COLLECTION,
      new Query(where("_id").is(new ObjectId(restaurantId))),
      new Update().push("menuItems", dbo));

}


         Atomic, in-place update of document

                                                       Slide 22
Callbacks – access driver API with
  exception translation
@Test
public void testDbCallback() {                     Exceptions are
  Restaurant ajanta = makeAjantaRestaurant();        translated
  restaurantRepository.add(ajanta);
  assertCollectionExists("restaurants2");
}

private Void assertCollectionExists(final String collectionName) {
  return mongoTemplate.execute(new DbCallback<Void>(){
   @Override
   public Void doInDB(DB db) {
     Set<String> collectionNames = db.getCollectionNames();
     Assert.assertTrue("Missing from " +
                  collectionNames,
                  collectionNames.contains(collectionName));
     return null;
   }});
}
                                                               Slide 23
Generic Mongo Repositories
   Generic Repositories support
 !  Basic CRUD methods
 !  Dynamic finders
 !  Pagination and sorting
   You define interface that extends
   Repository interface
   Spring Data generates Mongo-specific
   implementation at runtime


                                    Slide 24
Example Mongo Generic Repository
public class Person {
  private ObjectId id;
  private String firstname;
  private String lastname;
… getters and setters
}

interface PersonRepository
                     extends MongoRepository<Person, ObjectId> {
   List<Person> findByLastname(String lastName);
}

Person p = new Person("John", "Doe");
personRepository.save(p);

Person p2 = personRepository.findOne(p.getId());

List<Person> johnDoes = personRepository.findByLastname("Doe");
assertEquals(1, johnDoes.size());

                                                                   Slide 25
Example Mongo Repository config

<bean>

<mongo:repositories
 base-package="net.chrisrichardson.mongodb.example.mongorepository"
   mongo-template-ref="mongoTemplate" />

</beans>




     Scans classpath looking for
    subtypes of MongoRepository
        in the base package

                                                          Slide 26
Richer mapping                       Annotations define mapping:
                                       @Document, @Id, @Indexed,
                                       @PersistanceConstructor,
@Document                              @CompoundIndex, @DBRef,
public class Person {                  @GeoSpatialIndexed, @Value

 @Id                                   Map fields instead of properties "
 private ObjectId id;                  no getters or setters required
 private String firstname;
                                       Non-default constructor
 @Indexed
 private String lastname;              Index generation

  @PersistenceConstructor
  public Person(String firstname, String lastname) {
    this.firstname = firstname;
    this.lastname = lastname;
  }
….
}

                                                                 Slide 27
Richer mapping configuration
@Configuration
public class MongoExampleConfig extends AbstractMongoConfiguration
{
 …

    @Override
    public MongoTemplate mongoTemplate() throws Exception {
      return new MongoTemplate(mongo(),
                               mongoDbDatabase, null,
                               mappingMongoConverter());
    }

@Override
public String getMappingBasePackage() {
 return Person.class.getPackage().getName();
}

}
                                                              Slide 28
Support for the QueryDSL project
 Generated from                         Type-safe
 domain model class                     composable queries


QPerson person = QPerson.person;

Predicate predicate =
       person.homeAddress.street1.eq("1 High Street")
              .and(person.firstname.eq("John"))

List<Person> people = personRepository.findAll(predicate);

assertEquals(1, people.size());
assertPersonEquals(p, people.get(0));

                                                        Slide 29
Cross-store/polyglot persistence
                                Person person = new Person(…);
@Entity
public class Person {           entityManager.persist(person);
  // In Database
 @Id private Long id;           Person p2 = entityManager.find(…)
 private String firstname;
 private String lastname;

// In MongoDB
@RelatedDocument private Address address;



     { "_id" : ObjectId(”….."),
      "_entity_id" : NumberLong(1),
       "_entity_class" : "net.. Person",
     "_entity_field_name" : "address",
        "zip" : "94611", "street1" : "1 High Street", …}

                                                           Slide 30
Spring MongoDB – Future Ideas
   MongoTemplate
 !  Support common map-reduce operations
    from Mongo Cookbook
 !  GridFS integration
   Tighter integration with Spring MVC
   for activity monitoring
 !  See current example code on github




                                         Slide 31
Agenda
   Introduction to Spring
   Spring Data and MongoDB
   Introduction to Grails
   Using Grails with MongoDB




                               Slide 32
Grails




   Open-source web application framework
   Uses Groovy – dynamic programming language
   for the JVM
   Builds on mature frameworks such as Spring


                                           Slide 33
GORM = Grails Object Relational Mapping

   Uses convention over configuration
  !  Defaults for which classes to persist
  !  Defaults for their O/R mapping
   Leverages the meta-object protocol
  !  Adds persistence methods and properties to
     domain classes
  !  No equivalent of Hibernate Session
  !  Avoids the need for dependency injection
  !  Eliminates many DAO cookie-cutter methods




                                              Slide 34
Database access made easy
                                                       customer
 class Customer {                                      <<table>>

    String name                                     id <<pk>>
 }                                                  version
                                                    name



 Customer c = new Customer("John Doe")

 if (!c.save())
    fail "validation failed: ${c.errors}"            GORM adds
                                                     Methods and
 Customer c2 = Customer.get(c.id)                 properties to class
                                                      at runtime
 c2.delete()

 assertNull Customer.get(c.id)


 def customers = Customer.findAllByName(“Fred”)


                                                                   Slide 35
Relationships don’t have to be difficult

                                                customer
class Customer {                                <<table>>
   String name                               id <<pk>>
   static hasMany = [ accounts : Account]    version
}                                            name


class Account {
                                                 account
   static belongsTo = [customer: Customer]      <<table>>
   double balance
                                             id <<pk>>
}                                            version
                                             customer <<fk>>
 Customer c = <…>                            balance
 Account a = new Account(…)
 c.addToAccounts(a)

 assertSame c, a.customer
 assertTrue c.accounts.contains(a)




                                                         Slide 36
When the defaults aren’t right
class Customer {
   static transients = ["networth"]

    static mapping = {
      id column: 'customer_id'              crc_customer
                                              <<table>>
      table 'crc_customer'
      columns {                         customer_id <<pk>>
                                        version
         name column: 'customer_name'   customer_name
      }
    }


    def getNetworth() { …}
    …
}




                                                    Slide 37
Agenda
   Introduction to Spring
   Spring Data and MongoDB
   Introduction to Grails
   Using Grails with MongoDB




                               Slide 38
GORM for MongoDB
   Extends GORM to support MongoDB
   Announced Nov 2010
   Currently 1.0M5
   Builds on
 !  Spring Data for MongoDB
 !  Spring Data Mapping




                                 Slide 39
GORM/MongoDB example
grails uninstall-plugin hibernate
grails install-plugin mongodb

class Customer {
   String name                                                 Unchanged
   Address address
   static hasMany = [ accounts : Account]
   static embedded = ['address']
}                                            class Address {
                                               String street
class Account {                                String city
   static belongsTo = [customer: Customer]     String state
   double balance                              String zip
}                                            }
DataSource.groovy
mongo {
  host = "localhost"
}

                                                                Slide 40
GORM/MongoDB example

> db.customer.find()
{ "_id" : NumberLong(24), "address" : { "city" : "Oakland", "state" : "CA",
          "street" : "1 High Street", "zip" : "94619" }, "name" : "John Doe" }
{ "_id" : NumberLong(25), "address" : { "city" : "Oakland", "state" : "CA",
          "street" : "101 Broadway", "zip" : "94619" }, "name" : "Mary Jane" }

> db.account.find()
{ "_id" : NumberLong(1), "balance" : 60, "customer" : NumberLong(24),
  "name" : "Checking" }
{ "_id" : NumberLong(2), "balance" : 100, "customer" : NumberLong(24),
  "name" : "Savings" }
{ "_id" : NumberLong(3), "balance" : 0, "customer" : NumberLong(25),
  "name" : "Checking" }


       Domain class $ Collection
       Property $ Attribute
       Relationship $ "FK attribute"
                                                                        Slide 41
Cloud Foundry supports Mongo




    MongoDB is one of the provided services
" Deploy your MongoDB applications in
seconds

                                       Slide 42
Summary
  Polyglot persistence is here to stay
  Spring Data is here to help you
  GORM let’s you use the familiar and
  powerful GORM API with MongoDB
  Deploy your Mongo application on
  CloudFoundry.com
  More info at
 !  http://www.springframework.org/spring-data
 !  http://www.cloudfoundry.com/

                                             Slide 43
Next steps
                    Checkout Spring Data
                    Consider contributing


                    Deploy on CloudFoundry.com


             My contact information


             chris.richardson@springsource.com


             Twitter: @crichardson




                                            Slide 44

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionRichard Paul
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Murat Yener
 
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGThe Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGArun Gupta
 
Vaadin 7 - Java Enterprise Edition integration
Vaadin 7 - Java Enterprise Edition integrationVaadin 7 - Java Enterprise Edition integration
Vaadin 7 - Java Enterprise Edition integrationPeter Lehto
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Reza Rahman
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Datadeimos
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the HorizonJosh Juneau
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guidePankaj Singh
 
Jlook open api platform-sysdevguide
Jlook open api platform-sysdevguideJlook open api platform-sysdevguide
Jlook open api platform-sysdevguideHongSeong Jeon
 
Java interview questions
Java interview questionsJava interview questions
Java interview questionsSoba Arjun
 
Modules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemModules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemTim Ellison
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - CoreDzmitry Naskou
 
Gregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle WareGregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle Waredeimos
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012Alexandre Morgaut
 

Was ist angesagt? (17)

Introduction to Spring's Dependency Injection
Introduction to Spring's Dependency InjectionIntroduction to Spring's Dependency Injection
Introduction to Spring's Dependency Injection
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
 
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGThe Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
 
Vaadin 7 - Java Enterprise Edition integration
Vaadin 7 - Java Enterprise Edition integrationVaadin 7 - Java Enterprise Edition integration
Vaadin 7 - Java Enterprise Edition integration
 
Hibernate3 q&a
Hibernate3 q&aHibernate3 q&a
Hibernate3 q&a
 
Have You Seen Java EE Lately?
Have You Seen Java EE Lately?Have You Seen Java EE Lately?
Have You Seen Java EE Lately?
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Data
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the Horizon
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guide
 
Jlook open api platform-sysdevguide
Jlook open api platform-sysdevguideJlook open api platform-sysdevguide
Jlook open api platform-sysdevguide
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Modules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemModules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module System
 
Spring Framework - Core
Spring Framework - CoreSpring Framework - Core
Spring Framework - Core
 
Gregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle WareGregor Hohpe Track Intro The Cloud As Middle Ware
Gregor Hohpe Track Intro The Cloud As Middle Ware
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
Javaee6 Overview
Javaee6 OverviewJavaee6 Overview
Javaee6 Overview
 
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012
 

Andere mochten auch

MongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataMongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataChris Richardson
 
20 Fantastic Flat Icons and Their Meaning In Logo Design
20 Fantastic Flat Icons and Their Meaning In Logo Design20 Fantastic Flat Icons and Their Meaning In Logo Design
20 Fantastic Flat Icons and Their Meaning In Logo DesignDesignMantic
 
Spring + QueryDSL + MongoDB Presentation
Spring + QueryDSL + MongoDB PresentationSpring + QueryDSL + MongoDB Presentation
Spring + QueryDSL + MongoDB PresentationRanga Vadlamudi
 
Data meets Creativity - Webbdagarna 2015
Data meets Creativity - Webbdagarna 2015Data meets Creativity - Webbdagarna 2015
Data meets Creativity - Webbdagarna 2015Webrepublic
 
Tecnologìas de la Información y la Comunicación
Tecnologìas de la Información y la ComunicaciónTecnologìas de la Información y la Comunicación
Tecnologìas de la Información y la ComunicaciónYenmely
 
Grow Customer Retention with Predictive Marketing and User-Generated Content
Grow Customer Retention with Predictive Marketing and User-Generated ContentGrow Customer Retention with Predictive Marketing and User-Generated Content
Grow Customer Retention with Predictive Marketing and User-Generated ContentWhatConts
 
NOSQL Session GlueCon May 2010
NOSQL Session GlueCon May 2010NOSQL Session GlueCon May 2010
NOSQL Session GlueCon May 2010MongoDB
 
Strongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasStrongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasNorberto Leite
 
Revving Up Revenue By Replenishing
Revving Up Revenue By ReplenishingRevving Up Revenue By Replenishing
Revving Up Revenue By ReplenishingWhatConts
 
MongoDB and AWS Best Practices
MongoDB and AWS Best PracticesMongoDB and AWS Best Practices
MongoDB and AWS Best PracticesMongoDB
 
Av capabilities presentation
Av capabilities presentationAv capabilities presentation
Av capabilities presentationNAISales2
 
Old & wise(에듀시니어)
Old & wise(에듀시니어)Old & wise(에듀시니어)
Old & wise(에듀시니어)Jungku Hong
 
MongoDB at Flight Centre Ltd
MongoDB at Flight Centre LtdMongoDB at Flight Centre Ltd
MongoDB at Flight Centre LtdMongoDB
 
онлайн бронирование модуль для турагенств
онлайн бронирование модуль для турагенствонлайн бронирование модуль для турагенств
онлайн бронирование модуль для турагенствAdrian Parker
 
Samanage-Website-Redesign-Jan2017
Samanage-Website-Redesign-Jan2017Samanage-Website-Redesign-Jan2017
Samanage-Website-Redesign-Jan2017WhatConts
 
Cartagena Data Festival | Telling Stories with Data 2015 04-21
Cartagena Data Festival | Telling Stories with Data 2015 04-21Cartagena Data Festival | Telling Stories with Data 2015 04-21
Cartagena Data Festival | Telling Stories with Data 2015 04-21ulrichatz
 
Review: Leadership Frameworks
Review: Leadership FrameworksReview: Leadership Frameworks
Review: Leadership FrameworksMariam Nazarudin
 
O Diferencial de uma Estratégia Mobile...e Multiplataforma!
O Diferencial de uma Estratégia Mobile...e Multiplataforma!O Diferencial de uma Estratégia Mobile...e Multiplataforma!
O Diferencial de uma Estratégia Mobile...e Multiplataforma!Xpand IT
 

Andere mochten auch (20)

MongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataMongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring Data
 
20 Fantastic Flat Icons and Their Meaning In Logo Design
20 Fantastic Flat Icons and Their Meaning In Logo Design20 Fantastic Flat Icons and Their Meaning In Logo Design
20 Fantastic Flat Icons and Their Meaning In Logo Design
 
Spring + QueryDSL + MongoDB Presentation
Spring + QueryDSL + MongoDB PresentationSpring + QueryDSL + MongoDB Presentation
Spring + QueryDSL + MongoDB Presentation
 
Data meets Creativity - Webbdagarna 2015
Data meets Creativity - Webbdagarna 2015Data meets Creativity - Webbdagarna 2015
Data meets Creativity - Webbdagarna 2015
 
Special project
Special projectSpecial project
Special project
 
Tecnologìas de la Información y la Comunicación
Tecnologìas de la Información y la ComunicaciónTecnologìas de la Información y la Comunicación
Tecnologìas de la Información y la Comunicación
 
Grow Customer Retention with Predictive Marketing and User-Generated Content
Grow Customer Retention with Predictive Marketing and User-Generated ContentGrow Customer Retention with Predictive Marketing and User-Generated Content
Grow Customer Retention with Predictive Marketing and User-Generated Content
 
NOSQL Session GlueCon May 2010
NOSQL Session GlueCon May 2010NOSQL Session GlueCon May 2010
NOSQL Session GlueCon May 2010
 
Strongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasStrongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible Schemas
 
Revving Up Revenue By Replenishing
Revving Up Revenue By ReplenishingRevving Up Revenue By Replenishing
Revving Up Revenue By Replenishing
 
MongoDB and AWS Best Practices
MongoDB and AWS Best PracticesMongoDB and AWS Best Practices
MongoDB and AWS Best Practices
 
Av capabilities presentation
Av capabilities presentationAv capabilities presentation
Av capabilities presentation
 
Part 1
Part 1Part 1
Part 1
 
Old & wise(에듀시니어)
Old & wise(에듀시니어)Old & wise(에듀시니어)
Old & wise(에듀시니어)
 
MongoDB at Flight Centre Ltd
MongoDB at Flight Centre LtdMongoDB at Flight Centre Ltd
MongoDB at Flight Centre Ltd
 
онлайн бронирование модуль для турагенств
онлайн бронирование модуль для турагенствонлайн бронирование модуль для турагенств
онлайн бронирование модуль для турагенств
 
Samanage-Website-Redesign-Jan2017
Samanage-Website-Redesign-Jan2017Samanage-Website-Redesign-Jan2017
Samanage-Website-Redesign-Jan2017
 
Cartagena Data Festival | Telling Stories with Data 2015 04-21
Cartagena Data Festival | Telling Stories with Data 2015 04-21Cartagena Data Festival | Telling Stories with Data 2015 04-21
Cartagena Data Festival | Telling Stories with Data 2015 04-21
 
Review: Leadership Frameworks
Review: Leadership FrameworksReview: Leadership Frameworks
Review: Leadership Frameworks
 
O Diferencial de uma Estratégia Mobile...e Multiplataforma!
O Diferencial de uma Estratégia Mobile...e Multiplataforma!O Diferencial de uma Estratégia Mobile...e Multiplataforma!
O Diferencial de uma Estratégia Mobile...e Multiplataforma!
 

Ähnlich wie MongoDB for Java Devs with Spring Data - MongoPhilly 2011

Gnizr Architecture (for developers)
Gnizr Architecture (for developers)Gnizr Architecture (for developers)
Gnizr Architecture (for developers)hchen1
 
A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom Joshua Long
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3Oracle
 
Java one 2010
Java one 2010Java one 2010
Java one 2010scdn
 
Java database programming with jdbc
Java database programming with jdbcJava database programming with jdbc
Java database programming with jdbcsriram raj
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012Arun Gupta
 
The Java EE 7 Platform: Developing for the Cloud (FISL 12)
The Java EE 7 Platform: Developing for the Cloud  (FISL 12)The Java EE 7 Platform: Developing for the Cloud  (FISL 12)
The Java EE 7 Platform: Developing for the Cloud (FISL 12)Arun Gupta
 
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudTDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudArun Gupta
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFrameworkShankar Nair
 
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2Vladimir Bacvanski, PhD
 
Esri Dev Summit 2009 Rest and Mvc Final
Esri Dev Summit 2009 Rest and Mvc FinalEsri Dev Summit 2009 Rest and Mvc Final
Esri Dev Summit 2009 Rest and Mvc Finalguestcd4688
 
RESTful apps and services with ASP.NET MVC
RESTful apps and services with ASP.NET MVCRESTful apps and services with ASP.NET MVC
RESTful apps and services with ASP.NET MVCbnoyle
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundryJoshua Long
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration BackendArun Gupta
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?NexSoftsys
 
Spring db-access mod03
Spring db-access mod03Spring db-access mod03
Spring db-access mod03Guo Albert
 

Ähnlich wie MongoDB for Java Devs with Spring Data - MongoPhilly 2011 (20)

Gnizr Architecture (for developers)
Gnizr Architecture (for developers)Gnizr Architecture (for developers)
Gnizr Architecture (for developers)
 
A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom A Walking Tour of (almost) all of Springdom
A Walking Tour of (almost) all of Springdom
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
 
Java one 2010
Java one 2010Java one 2010
Java one 2010
 
Java database programming with jdbc
Java database programming with jdbcJava database programming with jdbc
Java database programming with jdbc
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
The Java EE 7 Platform: Developing for the Cloud (FISL 12)
The Java EE 7 Platform: Developing for the Cloud  (FISL 12)The Java EE 7 Platform: Developing for the Cloud  (FISL 12)
The Java EE 7 Platform: Developing for the Cloud (FISL 12)
 
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudTDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFramework
 
Spring survey
Spring surveySpring survey
Spring survey
 
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
Revolutionizing the Data Abstraction Layer with IBM Optim pureQuery and DB2
 
Esri Dev Summit 2009 Rest and Mvc Final
Esri Dev Summit 2009 Rest and Mvc FinalEsri Dev Summit 2009 Rest and Mvc Final
Esri Dev Summit 2009 Rest and Mvc Final
 
RESTful apps and services with ASP.NET MVC
RESTful apps and services with ASP.NET MVCRESTful apps and services with ASP.NET MVC
RESTful apps and services with ASP.NET MVC
 
Spring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud FoundrySpring in the Cloud - using Spring with Cloud Foundry
Spring in the Cloud - using Spring with Cloud Foundry
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration Backend
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?
 
Spring db-access mod03
Spring db-access mod03Spring db-access mod03
Spring db-access mod03
 
Spring Mvc
Spring MvcSpring Mvc
Spring Mvc
 

Mehr von MongoDB

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump StartMongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB
 

Mehr von MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

MongoDB for Java Devs with Spring Data - MongoPhilly 2011

  • 1. SpringSource and MongoDB Chris Richardson Author of POJOs in Action Founder of CloudFoundry.com Chris.Richardson@SpringSource.Com @crichardson
  • 2. Presentation Goal How SpringSource is making it easier for Java and Grails developers to build MongoDB applications Slide 2
  • 3. About Chris •  Grew up in England and live in Oakland, CA •  Over 25+ years of software development experience including 14 years of Java •  Speaker at JavaOne, SpringOne, NFJS, JavaPolis, Spring Experience, etc. •  Organize the Oakland JUG and the Groovy Grails meetup http://www.theregister.co.uk/2009/08/19/springsource_cloud_foundry/ Slide 3
  • 4. Agenda   Introduction to Spring   Spring Data and MongoDB   Introduction to Grails   Using Grails with MongoDB Slide 4
  • 5. The Spring framework   Rapid evolution !  Spring 1.0 – March 2004 !  Spring 2.0 – October 2006 !  Spring 2.5 – December 2007 !  Spring 3.0 – December 2009 !  … !  Complete backward compatibility   De facto standard programming model for enterprise Java   Two million+ developers Slide 5
  • 6. The Spring framework ecosystem Framework Description Spring framework The foundation Spring.NET .NET port of the Spring framework Spring Security (a.k.a. Acegi) Extensible framework providing authentication, authorization and instance-level security Spring Web Flow An excellent framework for building multi-page flows Spring Web Services Contract-first, document–centric SOAP web services Spring Dynamic Modules for OSGI Deploy Spring applications on OSGI Spring Batch Powerful batch processing framework Spring Integration Implements enterprise integration patterns Spring BlazeDS integration Support for Adobe BlazeDS Spring AMQP AMQP messaging, i.e. RabbitMQ Spring Gemfire Simplify Gemfire application development … Slide 6
  • 7. Spring programming model Dependency Injection: resolves inter-component Benefits: dependencies, • Improved developer metadata-driven productivity • Higher quality code • Portability across application servers POJO Aspect-Oriented Programming: Portable Service modular Abstractions: implementation of Transactions, data cross cutting access, … concerns Slide 7
  • 8. Portable service abstractions   Portable service abstractions insulate developer Business Logic from low-level programming Infrastructure code   Less code Spring   Simpler code Transactions Security Data access   Increased … productivity   Portable code Runtime Environment Slide 8
  • 9. Spring JDBC example @Repository class ActorDaoImpl implements ActorDao { SimpleJdbcTemplate hides @Autowired the low-level, messy private SimpleJdbcTemplate simpleJdbcTemplate; details of using JDBC public Actor findActor(String specialty, int age) { String sql = "select id, first_name, last_name from T_ACTOR" + " where specialty = ? and age = ?"; RowMapper<Actor> mapper = new RowMapper<Actor>() { public Actor mapRow(ResultSet rs, int rowNum) throws SQLException { Actor actor = new Actor(); actor.setId(rs.getLong("id")); actor.setFirstName(rs.getString("first_name")); actor.setLastName(rs.getString("last_name")); return actor; } }; return simpleJdbcTemplate.queryForObject(sql, mapper, specialty, age); } Slide 9
  • 10. Externalized database configuration @Configuration public class AppConfig { private @Value("#{jdbcProperties.url}") String jdbcUrl; private @Value("#{jdbcProperties.username}") String username; private @Value("#{jdbcProperties.password}") String password; @Bean public SimpleJdbcTemplate jdbcTemplate() { return new SimpleJdbcTemplate (dataSource()); } @Bean public DataSource dataSource() { return new DriverManagerDataSource(jdbcUrl, username, password); } } Reads DB configuration <context:component-scan base-package="..."/> from file <util:properties id="jdbcProperties" location="…/jdbc.properties"/> Slide 10
  • 11. Spring DataAccessException  Base class for exceptions thrown by DataAccess Exception DAOs  Consistent exception Concurrency Failure Exception ... handling across Hibernate, JPA, JDBC, Optimistic LockingFailure etc. Exception Pessimistic LockingFailure Exception  Unchecked exception  Extensible exception CannotSerialize mapping: CannotAcquire LockException Transaction Exception SqlExceptionTranslator 11
  • 12. Agenda   Introduction to the Spring framework   Spring Data and MongoDB   Introduction to Grails   Using Grails with MongoDB Slide 12
  • 13. Spring Data Project Goals   Bring classic Spring value propositions to a wide range of NoSQL databases: !  Productivity !  Programming model consistency: E.g. <NoSQL>Template classes !  “Portability”   Many entry points to use !  Auto-generated repository implementations !  Opinionated APIs (Think JdbcTemplate) !  Object Mapping (Java and GORM) !  Cross Store Persistence Programming model !  Productivity support in Roo and Grails Slide 13
  • 14. MongoDB API usage patterns   Create and store Mongo singleton   Externalized server details   Inserts/Updates !  Map application POJO " DBObject !  mongo.getDatabase(…).getCollection(…) !  Partial document updates   Queries !  mongo.getDatabase(…).getCollection(…) !  Iterate through Cursor !  Map DBObject " application POJO #  Higher-level than JDBC but still repetitive, … Slide 14
  • 15. Spring Data - MongoDB   MongoTemplate   Generic repository implementation   Querydsl integration   Cross-store persistence Slide 15
  • 16. MongoTemplate Simplifies data MongoTemplate POJO $ DBObject access databaseName mapping Translates userId Password exceptions defaultCollectionName writeConcern writeResultChecking <<interface>> save() MongoConvertor insert() write(Object, DBObject) remove() read(Class, DBObject) updateFirst() findOne() find() … SimpleMongo uses Converter Mongo MongoMapping (Java Driver class) Converter Slide 16
  • 17. Example entity public class Restaurant { private String id; private String name; private List<MenuItem> menuItems; public Restaurant() { } public class MenuItem { private String name; public Restaurant(String name) { private double price; this.name = name; … public MenuItem() { } } public String getName() { return name; } public MenuItem(String name, double price) { this.name = name; public void setName(String name) { this.price = price; this.name = name; } } …getters and setters… …getters and setters… Slide 17
  • 18. Example data access code @Repository public class RestaurantRepository { @Autowired private MongoTemplate mongoTemplate; public static final String RESTAURANTS_COLLECTION = "restaurants2"; public void add(Restaurant restaurant) { mongoTemplate.save(RESTAURANTS_COLLECTION, restaurant); } public List<Restaurant> findRestaurantsByName(String restaurantName) { return mongoTemplate.find(RESTAURANTS_COLLECTION, new Query(where("name").is(restaurantName)), Restaurant.class); } Slide 18
  • 19. Mongo document { "_id" : ObjectId("4d977f55d3fe3119c904e026"), "menuItems" : [ { "name" : "Tandoori Portobello Mushrooms", "price" : 5.5 }, { "name" : "Duck Curry Kerala", "price" : 15 } ], "name" : "Ajanta" } Slide 19
  • 20. Spring MongoDB Example - Config @Configuration public class MongoDbExampleConfig { private @Value("#{mongoDbProperties.databaseName}") String mongoDbDatabase; private @Value("#{mongoDbProperties.host}") String mongoDbHost; @Bean public Mongo mongo() throws Exception { Singleton return new Mongo(mongoDbHost); } @Bean public MongoTemplate mongoTemplate(Mongo mongo) { return new MongoTemplate(mongo, mongoDbDatabase); }… <beans> <context:annotation-config/> External Config <context:component-scan base-package="net.chrisrichardson.mongodb.example"/> mongodb.properties: <util:properties id="mongoDbProperties" location="mongodb.properties"/> databaseName=demo1 </beans> host=192.168.253.150 Slide 20
  • 21. Spring MongoDB Example Test public class MongoDbExampleTest { @Autowired private RestaurantRepository restaurantRepository; @Test public void test() { Restaurant ajanta = makeAjantaRestaurant(); restaurantRepository.add(ajanta); List<Restaurant> results = restaurantRepository.findRestaurantsByName("Ajanta"); assertRestaurantFound(ajanta, results); } private Restaurant makeAjantaRestaurant() { Restaurant ajanta = new Restaurant("Ajanta"); ajanta.add(new MenuItem("Tandoori Portobello Mushrooms", 5.50)); ajanta.add(new MenuItem("Duck Curry Kerala", 15.00)); return ajanta; } … Slide 21
  • 22. Update example @Repository public class RestaurantRepository { public void addMenuItem(String restaurantId, MenuItem newMenuItem) { DBObject dbo = new BasicDBObject(); mongoTemplate.getConverter().write(newMenuItem, dbo); mongoTemplate.updateFirst(RESTAURANTS_COLLECTION, new Query(where("_id").is(new ObjectId(restaurantId))), new Update().push("menuItems", dbo)); } Atomic, in-place update of document Slide 22
  • 23. Callbacks – access driver API with exception translation @Test public void testDbCallback() { Exceptions are Restaurant ajanta = makeAjantaRestaurant(); translated restaurantRepository.add(ajanta); assertCollectionExists("restaurants2"); } private Void assertCollectionExists(final String collectionName) { return mongoTemplate.execute(new DbCallback<Void>(){ @Override public Void doInDB(DB db) { Set<String> collectionNames = db.getCollectionNames(); Assert.assertTrue("Missing from " + collectionNames, collectionNames.contains(collectionName)); return null; }}); } Slide 23
  • 24. Generic Mongo Repositories   Generic Repositories support !  Basic CRUD methods !  Dynamic finders !  Pagination and sorting   You define interface that extends Repository interface   Spring Data generates Mongo-specific implementation at runtime Slide 24
  • 25. Example Mongo Generic Repository public class Person { private ObjectId id; private String firstname; private String lastname; … getters and setters } interface PersonRepository extends MongoRepository<Person, ObjectId> { List<Person> findByLastname(String lastName); } Person p = new Person("John", "Doe"); personRepository.save(p); Person p2 = personRepository.findOne(p.getId()); List<Person> johnDoes = personRepository.findByLastname("Doe"); assertEquals(1, johnDoes.size()); Slide 25
  • 26. Example Mongo Repository config <bean> <mongo:repositories base-package="net.chrisrichardson.mongodb.example.mongorepository" mongo-template-ref="mongoTemplate" /> </beans> Scans classpath looking for subtypes of MongoRepository in the base package Slide 26
  • 27. Richer mapping Annotations define mapping: @Document, @Id, @Indexed, @PersistanceConstructor, @Document @CompoundIndex, @DBRef, public class Person { @GeoSpatialIndexed, @Value @Id Map fields instead of properties " private ObjectId id; no getters or setters required private String firstname; Non-default constructor @Indexed private String lastname; Index generation @PersistenceConstructor public Person(String firstname, String lastname) { this.firstname = firstname; this.lastname = lastname; } …. } Slide 27
  • 28. Richer mapping configuration @Configuration public class MongoExampleConfig extends AbstractMongoConfiguration { … @Override public MongoTemplate mongoTemplate() throws Exception { return new MongoTemplate(mongo(), mongoDbDatabase, null, mappingMongoConverter()); } @Override public String getMappingBasePackage() { return Person.class.getPackage().getName(); } } Slide 28
  • 29. Support for the QueryDSL project Generated from Type-safe domain model class composable queries QPerson person = QPerson.person; Predicate predicate = person.homeAddress.street1.eq("1 High Street") .and(person.firstname.eq("John")) List<Person> people = personRepository.findAll(predicate); assertEquals(1, people.size()); assertPersonEquals(p, people.get(0)); Slide 29
  • 30. Cross-store/polyglot persistence Person person = new Person(…); @Entity public class Person { entityManager.persist(person); // In Database @Id private Long id; Person p2 = entityManager.find(…) private String firstname; private String lastname; // In MongoDB @RelatedDocument private Address address; { "_id" : ObjectId(”….."), "_entity_id" : NumberLong(1), "_entity_class" : "net.. Person", "_entity_field_name" : "address", "zip" : "94611", "street1" : "1 High Street", …} Slide 30
  • 31. Spring MongoDB – Future Ideas   MongoTemplate !  Support common map-reduce operations from Mongo Cookbook !  GridFS integration   Tighter integration with Spring MVC for activity monitoring !  See current example code on github Slide 31
  • 32. Agenda   Introduction to Spring   Spring Data and MongoDB   Introduction to Grails   Using Grails with MongoDB Slide 32
  • 33. Grails   Open-source web application framework   Uses Groovy – dynamic programming language for the JVM   Builds on mature frameworks such as Spring Slide 33
  • 34. GORM = Grails Object Relational Mapping   Uses convention over configuration !  Defaults for which classes to persist !  Defaults for their O/R mapping   Leverages the meta-object protocol !  Adds persistence methods and properties to domain classes !  No equivalent of Hibernate Session !  Avoids the need for dependency injection !  Eliminates many DAO cookie-cutter methods Slide 34
  • 35. Database access made easy customer class Customer { <<table>> String name id <<pk>> } version name Customer c = new Customer("John Doe") if (!c.save()) fail "validation failed: ${c.errors}" GORM adds Methods and Customer c2 = Customer.get(c.id) properties to class at runtime c2.delete() assertNull Customer.get(c.id) def customers = Customer.findAllByName(“Fred”) Slide 35
  • 36. Relationships don’t have to be difficult customer class Customer { <<table>> String name id <<pk>> static hasMany = [ accounts : Account] version } name class Account { account static belongsTo = [customer: Customer] <<table>> double balance id <<pk>> } version customer <<fk>> Customer c = <…> balance Account a = new Account(…) c.addToAccounts(a) assertSame c, a.customer assertTrue c.accounts.contains(a) Slide 36
  • 37. When the defaults aren’t right class Customer { static transients = ["networth"] static mapping = { id column: 'customer_id' crc_customer <<table>> table 'crc_customer' columns { customer_id <<pk>> version name column: 'customer_name' customer_name } } def getNetworth() { …} … } Slide 37
  • 38. Agenda   Introduction to Spring   Spring Data and MongoDB   Introduction to Grails   Using Grails with MongoDB Slide 38
  • 39. GORM for MongoDB   Extends GORM to support MongoDB   Announced Nov 2010   Currently 1.0M5   Builds on !  Spring Data for MongoDB !  Spring Data Mapping Slide 39
  • 40. GORM/MongoDB example grails uninstall-plugin hibernate grails install-plugin mongodb class Customer { String name Unchanged Address address static hasMany = [ accounts : Account] static embedded = ['address'] } class Address { String street class Account { String city static belongsTo = [customer: Customer] String state double balance String zip } } DataSource.groovy mongo { host = "localhost" } Slide 40
  • 41. GORM/MongoDB example > db.customer.find() { "_id" : NumberLong(24), "address" : { "city" : "Oakland", "state" : "CA", "street" : "1 High Street", "zip" : "94619" }, "name" : "John Doe" } { "_id" : NumberLong(25), "address" : { "city" : "Oakland", "state" : "CA", "street" : "101 Broadway", "zip" : "94619" }, "name" : "Mary Jane" } > db.account.find() { "_id" : NumberLong(1), "balance" : 60, "customer" : NumberLong(24), "name" : "Checking" } { "_id" : NumberLong(2), "balance" : 100, "customer" : NumberLong(24), "name" : "Savings" } { "_id" : NumberLong(3), "balance" : 0, "customer" : NumberLong(25), "name" : "Checking" }   Domain class $ Collection   Property $ Attribute   Relationship $ "FK attribute" Slide 41
  • 42. Cloud Foundry supports Mongo   MongoDB is one of the provided services " Deploy your MongoDB applications in seconds Slide 42
  • 43. Summary   Polyglot persistence is here to stay   Spring Data is here to help you   GORM let’s you use the familiar and powerful GORM API with MongoDB   Deploy your Mongo application on CloudFoundry.com   More info at !  http://www.springframework.org/spring-data !  http://www.cloudfoundry.com/ Slide 43
  • 44. Next steps Checkout Spring Data Consider contributing Deploy on CloudFoundry.com My contact information chris.richardson@springsource.com Twitter: @crichardson Slide 44