Package org.hibernate.ogm.datastore.mongodb.impl

Examples of org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider


    MockMongoClient mockClient = mockClient()
        .insert( "GolfPlayer", player )
        .insert( "GolfCourse", getGolfCourse() )
        .build();

    setupSessionFactory( new MongoDBDatastoreProvider( mockClient.getClient() ) );

    Session session = sessions.openSession();
    Transaction transaction = session.beginTransaction();

    // when getting the golf player
View Full Code Here


        .insert( "GolfPlayer", getPlayer() )
        .insert( "GolfCourse", getGolfCourse() )
        .insert( "Associations", getPlayedCoursesAssociationAsDocument() )
        .build();

    setupSessionFactory( new MongoDBDatastoreProvider( mockClient.getClient() ), AssociationStorageType.ASSOCIATION_DOCUMENT );

    Session session = sessions.openSession();
    Transaction transaction = session.beginTransaction();

    // when getting the golf player
View Full Code Here

    );
  }

  @Override
  protected void addExtraColumn() {
    MongoDBDatastoreProvider provider = (MongoDBDatastoreProvider) super.getService( DatastoreProvider.class );
    DB database = provider.getDatabase();
    DBCollection collection = database.getCollection( "Project" );

    BasicDBObject query = new BasicDBObject( 1 );
    query.put( "_id", "projectID" );
View Full Code Here

  @Test
  @SuppressWarnings("unchecked")
  public void shouldApplyConfiguredWriteConcernForInsertOfTuple() {
    // given an empty database
    MockMongoClient mockClient = mockClient().build();
    setupSessionFactory( new MongoDBDatastoreProvider( mockClient.getClient() ) );

    final Session session = sessions.openSession();
    Transaction transaction = session.beginTransaction();

    // when inserting a golf player
View Full Code Here

  public void shouldApplyConfiguredWriteConcernForUpdateOfTuple() {
    // given a database with a golf player
    MockMongoClient mockClient = mockClient()
        .insert( "GolfPlayer", getPlayer() )
        .build();
    setupSessionFactory( new MongoDBDatastoreProvider( mockClient.getClient() ) );

    final Session session = sessions.openSession();
    Transaction transaction = session.beginTransaction();

    // when updating the golf player
View Full Code Here

    // given a database with a golf player
    MockMongoClient mockClient = mockClient()
        .insert( "GolfPlayer", getPlayer() )
        .build();

    setupSessionFactory( new MongoDBDatastoreProvider( mockClient.getClient() ) );

    final Session session = sessions.openSession();
    Transaction transaction = session.beginTransaction();

    // when removing the golf player
View Full Code Here

   * To be sure the datastoreProvider retrieves only the columns we want,
   * an extra column is manually added to the association document
   */
  @Override
  protected void addExtraColumn() {
    MongoDBDatastoreProvider provider = (MongoDBDatastoreProvider) super.getService( DatastoreProvider.class );
    DB database = provider.getDatabase();
    DBCollection collection = database.getCollection( "Associations" );

    final BasicDBObject idObject = new BasicDBObject( 2 );
    idObject.append( "Project_id", "projectID" );
    idObject.append( "table", "Project_Module" );
View Full Code Here

    MockMongoClient mockClient = mockClient()
        .insert( "GolfPlayer", getPlayer() )
        .insert( "GolfCourse", getGolfCourse() )
        .build();

    setupSessionFactory( new MongoDBDatastoreProvider( mockClient.getClient() ) );

    Session session = sessions.openSession();
    Transaction transaction = session.beginTransaction();

    // when associating the golf course to the player
View Full Code Here

  @Test
  public void shouldApplyConfiguredWriteConcernForCreationOfAssociationStoredAsDocument() {
    // given an empty database
    MockMongoClient mockClient = mockClient().build();
    setupSessionFactory( new MongoDBDatastoreProvider( mockClient.getClient() ), AssociationStorageType.ASSOCIATION_DOCUMENT );

    Session session = sessions.openSession();
    Transaction transaction = session.beginTransaction();

    // when inserting a player with an associated course
View Full Code Here

  public void shouldApplyWriteConcernConfiguredOnPropertyLevelForCreationOfAssociationStoredAsDocument() {
    // given an empty database
    MockMongoClient mockClient = mockClient().build();

    OgmConfiguration configuration = TestHelper.getDefaultTestConfiguration( getAnnotatedClasses() );
    configuration.getProperties().put( OgmProperties.DATASTORE_PROVIDER, new MongoDBDatastoreProvider( mockClient.getClient() ) );
    configuration.getProperties().put( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.ASSOCIATION_DOCUMENT );
    configuration.configureOptionsFor( MongoDB.class )
      .entity( GolfPlayer.class )
        .writeConcern( WriteConcernType.REPLICA_ACKNOWLEDGED )
        .property( "playedCourses", ElementType.FIELD )
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.