SlideShare a Scribd company logo
1 of 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
o  Introduction to Spring
o  Spring Data and MongoDB
o  Introduction to Grails
o  Using Grails with MongoDB




                               Slide 4
The Spring framework
o  Rapid evolution
  n    Spring 1.0 – March 2004
  n    Spring 2.0 – October 2006
  n    Spring 2.5 – December 2007
  n    Spring 3.0 – December 2009
  n    …
  n    Complete backward compatibility
o  De facto standard programming
   model for enterprise Java
o  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
o  Portable service
   abstractions
   insulate developer         Business
                               Logic
   from low-level
   programming                Infrastructure code




o  Less code                    Spring

o  Simpler code                  Transactions
                                   Security
                                 Data access


o  Increased
                                      …




   productivity
o  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
o Base class for
exceptions thrown by                                DataAccess
                                                     Exception

DAOs
o Consistent exception              Concurrency
                                      Failure
                                     Exception
                                                                   ...


handling across
Hibernate, JPA, JDBC,      Optimistic
                         LockingFailure

etc.                       Exception               Pessimistic
                                                  LockingFailure
                                                    Exception

o Unchecked exception
o Extensible exception                                       CannotSerialize

mapping:                            CannotAcquire
                                    LockException
                                                              Transaction
                                                               Exception

SqlExceptionTranslator

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




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

Ø  Higher-level than JDBC but still repetitive,
                        …

                                              Slide 14
Spring Data - MongoDB
o  MongoTemplate
o  Generic repository implementation
o  Querydsl integration
o  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
o  Generic Repositories support
  n  Basic CRUD methods
  n  Dynamic finders
  n  Pagination and sorting
o  You define interface that extends
   Repository interface
o  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
o  MongoTemplate
  n  Support common map-reduce operations
      from Mongo Cookbook
  n  GridFS integration
o  Tighter integration with Spring MVC
   for activity monitoring
  n  See current example code on github




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




                               Slide 32
Grails




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


                                           Slide 33
GORM = Grails Object Relational Mapping

o  Uses convention over configuration
  n  Defaults for which classes to persist
  n  Defaults for their O/R mapping
o  Leverages the meta-object protocol
  n  Adds persistence methods and properties to
      domain classes
  n  No equivalent of Hibernate Session
  n  Avoids the need for dependency injection
  n  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
o  Introduction to Spring
o  Spring Data and MongoDB
o  Introduction to Grails
o  Using Grails with MongoDB




                               Slide 38
GORM for MongoDB
o  Extends GORM to support MongoDB
o  Announced Nov 2010
o  Currently 1.0M5
o  Builds on
  n  Spring Data for MongoDB
  n  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" }


  o  Domain class ó Collection
  o  Property ó Attribute
  o  Relationship ó "FK attribute"
                                                                        Slide 41
Cloud Foundry supports Mongo




o  MongoDB is one of the provided services
è Deploy your MongoDB applications in
seconds

                                      Slide 42
Summary
o  Polyglot persistence is here to stay
o  Spring Data is here to help you
o  GORM let’s you use the familiar and
   powerful GORM API with MongoDB
o  Deploy your Mongo application on
   CloudFoundry.com
o  More info at
  n  http://www.springframework.org/spring-data
  n  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

More Related Content

What's hot

하이퍼커넥트 데이터 팀이 데이터 증가에 대처해온 기록
하이퍼커넥트 데이터 팀이 데이터 증가에 대처해온 기록하이퍼커넥트 데이터 팀이 데이터 증가에 대처해온 기록
하이퍼커넥트 데이터 팀이 데이터 증가에 대처해온 기록Jaehyeuk Oh
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.Jurriaan Persyn
 
マルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことマルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことAmazon Web Services Japan
 
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DBDistributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DBYugabyteDB
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advanceDaeMyung Kang
 
Laravel로 스타트업 기술 스택 구성하기
Laravel로 스타트업 기술 스택 구성하기Laravel로 스타트업 기술 스택 구성하기
Laravel로 스타트업 기술 스택 구성하기KwangSeob Jeong
 
サイボウズの開発を支える GitHub × CircleCI
サイボウズの開発を支える GitHub × CircleCIサイボウズの開発を支える GitHub × CircleCI
サイボウズの開発を支える GitHub × CircleCIJumpei Miyata
 
Java ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugJava ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugMasatoshi Tada
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architectureBishal Khanal
 
Introduction to Python Programing
Introduction to Python ProgramingIntroduction to Python Programing
Introduction to Python Programingsameer patil
 
⼤語⾔模型 LLM 應⽤開發入⾨
⼤語⾔模型 LLM 應⽤開發入⾨⼤語⾔模型 LLM 應⽤開發入⾨
⼤語⾔模型 LLM 應⽤開發入⾨Wen-Tien Chang
 
Kongの概要と導入事例
Kongの概要と導入事例Kongの概要と導入事例
Kongの概要と導入事例briscola-tokyo
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
趣味と仕事の違い、現場で求められるアプリケーションの可観測性
趣味と仕事の違い、現場で求められるアプリケーションの可観測性趣味と仕事の違い、現場で求められるアプリケーションの可観測性
趣味と仕事の違い、現場で求められるアプリケーションの可観測性LIFULL Co., Ltd.
 
FlutterでのWidgetツリーへの状態伝播とアクセス制限の基本戦略
FlutterでのWidgetツリーへの状態伝播とアクセス制限の基本戦略FlutterでのWidgetツリーへの状態伝播とアクセス制限の基本戦略
FlutterでのWidgetツリーへの状態伝播とアクセス制限の基本戦略cch-robo
 
コンテナ環境でJavaイメージを小さくする方法!
コンテナ環境でJavaイメージを小さくする方法!コンテナ環境でJavaイメージを小さくする方法!
コンテナ環境でJavaイメージを小さくする方法!オラクルエンジニア通信
 
SpringBoot 3 Observability
SpringBoot 3 ObservabilitySpringBoot 3 Observability
SpringBoot 3 ObservabilityKnoldus Inc.
 
もうひとつのアンチパターン OTLT、あるいは如何にして私はオレオレフレームワークを忌み嫌うようになったか
もうひとつのアンチパターン OTLT、あるいは如何にして私はオレオレフレームワークを忌み嫌うようになったかもうひとつのアンチパターン OTLT、あるいは如何にして私はオレオレフレームワークを忌み嫌うようになったか
もうひとつのアンチパターン OTLT、あるいは如何にして私はオレオレフレームワークを忌み嫌うようになったかsuno88
 

What's hot (20)

하이퍼커넥트 데이터 팀이 데이터 증가에 대처해온 기록
하이퍼커넥트 데이터 팀이 데이터 증가에 대처해온 기록하이퍼커넥트 데이터 팀이 데이터 증가에 대처해온 기록
하이퍼커넥트 데이터 팀이 데이터 증가에 대처해온 기록
 
An Introduction to Elastic Search.
An Introduction to Elastic Search.An Introduction to Elastic Search.
An Introduction to Elastic Search.
 
マルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことマルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのこと
 
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DBDistributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advance
 
Laravel로 스타트업 기술 스택 구성하기
Laravel로 스타트업 기술 스택 구성하기Laravel로 스타트업 기술 스택 구성하기
Laravel로 스타트업 기술 스택 구성하기
 
サイボウズの開発を支える GitHub × CircleCI
サイボウズの開発を支える GitHub × CircleCIサイボウズの開発を支える GitHub × CircleCI
サイボウズの開発を支える GitHub × CircleCI
 
NGINXをBFF (Backend for Frontend)として利用した話
NGINXをBFF (Backend for Frontend)として利用した話NGINXをBFF (Backend for Frontend)として利用した話
NGINXをBFF (Backend for Frontend)として利用した話
 
Java ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugJava ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsug
 
Mavenの真実とウソ
Mavenの真実とウソMavenの真実とウソ
Mavenの真実とウソ
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
Introduction to Python Programing
Introduction to Python ProgramingIntroduction to Python Programing
Introduction to Python Programing
 
⼤語⾔模型 LLM 應⽤開發入⾨
⼤語⾔模型 LLM 應⽤開發入⾨⼤語⾔模型 LLM 應⽤開發入⾨
⼤語⾔模型 LLM 應⽤開發入⾨
 
Kongの概要と導入事例
Kongの概要と導入事例Kongの概要と導入事例
Kongの概要と導入事例
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
趣味と仕事の違い、現場で求められるアプリケーションの可観測性
趣味と仕事の違い、現場で求められるアプリケーションの可観測性趣味と仕事の違い、現場で求められるアプリケーションの可観測性
趣味と仕事の違い、現場で求められるアプリケーションの可観測性
 
FlutterでのWidgetツリーへの状態伝播とアクセス制限の基本戦略
FlutterでのWidgetツリーへの状態伝播とアクセス制限の基本戦略FlutterでのWidgetツリーへの状態伝播とアクセス制限の基本戦略
FlutterでのWidgetツリーへの状態伝播とアクセス制限の基本戦略
 
コンテナ環境でJavaイメージを小さくする方法!
コンテナ環境でJavaイメージを小さくする方法!コンテナ環境でJavaイメージを小さくする方法!
コンテナ環境でJavaイメージを小さくする方法!
 
SpringBoot 3 Observability
SpringBoot 3 ObservabilitySpringBoot 3 Observability
SpringBoot 3 Observability
 
もうひとつのアンチパターン OTLT、あるいは如何にして私はオレオレフレームワークを忌み嫌うようになったか
もうひとつのアンチパターン OTLT、あるいは如何にして私はオレオレフレームワークを忌み嫌うようになったかもうひとつのアンチパターン OTLT、あるいは如何にして私はオレオレフレームワークを忌み嫌うようになったか
もうひとつのアンチパターン OTLT、あるいは如何にして私はオレオレフレームワークを忌み嫌うようになったか
 

Similar to SpringSource and MongoDB: Making Java and Grails MongoDB Apps Easier

MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB
 
Gnizr Architecture (for developers)
Gnizr Architecture (for developers)Gnizr Architecture (for developers)
Gnizr Architecture (for developers)hchen1
 
Java one 2010
Java one 2010Java one 2010
Java one 2010scdn
 
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
 
Java database programming with jdbc
Java database programming with jdbcJava database programming with jdbc
Java database programming with jdbcsriram raj
 
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
 
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
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3Oracle
 
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
 
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
 
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
 
NIG系統報表開發指南
NIG系統報表開發指南NIG系統報表開發指南
NIG系統報表開發指南Guo Albert
 
Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Kuo-Chun Su
 
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
 

Similar to SpringSource and MongoDB: Making Java and Grails MongoDB Apps Easier (20)

MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB for Java Devs with Spring Data - MongoPhilly 2011
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)
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 
Java one 2010
Java one 2010Java one 2010
Java one 2010
 
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
 
Java database programming with jdbc
Java database programming with jdbcJava database programming with jdbc
Java database programming with jdbc
 
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
 
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
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
 
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
 
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
 
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
 
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
 
CQ5 and Sling overview
CQ5 and Sling overviewCQ5 and Sling overview
CQ5 and Sling overview
 
NIG系統報表開發指南
NIG系統報表開發指南NIG系統報表開發指南
NIG系統報表開發指南
 
Spring survey
Spring surveySpring survey
Spring survey
 
Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Spring Data MongoDB 介紹
Spring Data MongoDB 介紹
 
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
 

More from Chris Richardson

The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?Chris Richardson
 
More the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternMore the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternChris Richardson
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...Chris Richardson
 
Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Chris Richardson
 
Dark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsDark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsChris Richardson
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfScenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfChris Richardson
 
Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Chris Richardson
 
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...Chris Richardson
 
Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Chris Richardson
 
A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 Chris Richardson
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureQConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureChris Richardson
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Chris Richardson
 
Designing loosely coupled services
Designing loosely coupled servicesDesigning loosely coupled services
Designing loosely coupled servicesChris Richardson
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Chris Richardson
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...Chris Richardson
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Chris Richardson
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...Chris Richardson
 
Overview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationOverview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationChris Richardson
 
An overview of the Eventuate Platform
An overview of the Eventuate PlatformAn overview of the Eventuate Platform
An overview of the Eventuate PlatformChris Richardson
 
#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolithChris Richardson
 

More from Chris Richardson (20)

The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?
 
More the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternMore the merrier: a microservices anti-pattern
More the merrier: a microservices anti-pattern
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
 
Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!
 
Dark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsDark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patterns
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfScenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
 
Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions
 
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
 
Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...
 
A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 A pattern language for microservices - June 2021
A pattern language for microservices - June 2021
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureQConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
 
Designing loosely coupled services
Designing loosely coupled servicesDesigning loosely coupled services
Designing loosely coupled services
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
 
Overview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationOverview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders application
 
An overview of the Eventuate Platform
An overview of the Eventuate PlatformAn overview of the Eventuate Platform
An overview of the Eventuate Platform
 
#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith
 

Recently uploaded

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 

SpringSource and MongoDB: Making Java and Grails MongoDB Apps Easier

  • 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 o  Introduction to Spring o  Spring Data and MongoDB o  Introduction to Grails o  Using Grails with MongoDB Slide 4
  • 5. The Spring framework o  Rapid evolution n  Spring 1.0 – March 2004 n  Spring 2.0 – October 2006 n  Spring 2.5 – December 2007 n  Spring 3.0 – December 2009 n  … n  Complete backward compatibility o  De facto standard programming model for enterprise Java o  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 o  Portable service abstractions insulate developer Business Logic from low-level programming Infrastructure code o  Less code Spring o  Simpler code Transactions Security Data access o  Increased … productivity o  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 o Base class for exceptions thrown by DataAccess Exception DAOs o Consistent exception Concurrency Failure Exception ... handling across Hibernate, JPA, JDBC, Optimistic LockingFailure etc. Exception Pessimistic LockingFailure Exception o Unchecked exception o Extensible exception CannotSerialize mapping: CannotAcquire LockException Transaction Exception SqlExceptionTranslator 11
  • 12. Agenda o  Introduction to the Spring framework o  Spring Data and MongoDB o  Introduction to Grails o  Using Grails with MongoDB Slide 12
  • 13. Spring Data Project Goals o  Bring classic Spring value propositions to a wide range of NoSQL databases: n  Productivity n  Programming model consistency: E.g. <NoSQL>Template classes n  “Portability” o  Many entry points to use n  Auto-generated repository implementations n  Opinionated APIs (Think JdbcTemplate) n  Object Mapping (Java and GORM) n  Cross Store Persistence Programming model n  Productivity support in Roo and Grails Slide 13
  • 14. MongoDB API usage patterns o  Create and store Mongo singleton o  Externalized server details o  Inserts/Updates n  Map application POJO è DBObject n  mongo.getDatabase(…).getCollection(…) n  Partial document updates o  Queries n  mongo.getDatabase(…).getCollection(…) n  Iterate through Cursor n  Map DBObject è application POJO Ø  Higher-level than JDBC but still repetitive, … Slide 14
  • 15. Spring Data - MongoDB o  MongoTemplate o  Generic repository implementation o  Querydsl integration o  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 o  Generic Repositories support n  Basic CRUD methods n  Dynamic finders n  Pagination and sorting o  You define interface that extends Repository interface o  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 o  MongoTemplate n  Support common map-reduce operations from Mongo Cookbook n  GridFS integration o  Tighter integration with Spring MVC for activity monitoring n  See current example code on github Slide 31
  • 32. Agenda o  Introduction to Spring o  Spring Data and MongoDB o  Introduction to Grails o  Using Grails with MongoDB Slide 32
  • 33. Grails o  Open-source web application framework o  Uses Groovy – dynamic programming language for the JVM o  Builds on mature frameworks such as Spring Slide 33
  • 34. GORM = Grails Object Relational Mapping o  Uses convention over configuration n  Defaults for which classes to persist n  Defaults for their O/R mapping o  Leverages the meta-object protocol n  Adds persistence methods and properties to domain classes n  No equivalent of Hibernate Session n  Avoids the need for dependency injection n  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 o  Introduction to Spring o  Spring Data and MongoDB o  Introduction to Grails o  Using Grails with MongoDB Slide 38
  • 39. GORM for MongoDB o  Extends GORM to support MongoDB o  Announced Nov 2010 o  Currently 1.0M5 o  Builds on n  Spring Data for MongoDB n  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" } o  Domain class ó Collection o  Property ó Attribute o  Relationship ó "FK attribute" Slide 41
  • 42. Cloud Foundry supports Mongo o  MongoDB is one of the provided services è Deploy your MongoDB applications in seconds Slide 42
  • 43. Summary o  Polyglot persistence is here to stay o  Spring Data is here to help you o  GORM let’s you use the familiar and powerful GORM API with MongoDB o  Deploy your Mongo application on CloudFoundry.com o  More info at n  http://www.springframework.org/spring-data n  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