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

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


    }
  }

  @Override
  public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );

    // We need to execute the previous operations first or it won't be able to find the key that should have
    // been created
    executeBatch( associationContext.getOperationsQueue() );
    if ( storageStrategy.isEmbeddedInEntity() ) {
      DBObject entity = getObjectAsEmbeddedAssociation( key );
      if ( getAssociationFieldOrNull( key, entity ) != null ) {
        return new Association( new MongoDBAssociationSnapshot( entity, key, storageStrategy ) );
      }
      else {
View Full Code Here


    return field;
  }

  @Override
  public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );

    if ( storageStrategy.isEmbeddedInEntity() ) {
      DBObject entity = getObjectAsEmbeddedAssociation( key );
      boolean insert = false;
      if ( entity == null ) {
        insert = true;
        entity = this.prepareIdObject( key.getEntityKey() );
View Full Code Here

    DBCollection collection;
    DBObject query;
    MongoDBAssociationSnapshot assocSnapshot = (MongoDBAssociationSnapshot) association.getSnapshot();
    String associationField;

    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );

    // We need to execute the previous operations first or it won't be able to find the key that should have
    // been created
    executeBatch( associationContext.getOperationsQueue() );
    if ( storageStrategy.isEmbeddedInEntity() ) {
      collection = this.getCollection( key.getEntityKey() );
      query = this.prepareIdObject( key.getEntityKey() );
      associationField = key.getCollectionRole();
    }
    else {
View Full Code Here

    }
  }

  @Override
  public void removeAssociation(AssociationKey key, AssociationContext associationContext) {
    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );

    if ( storageStrategy.isEmbeddedInEntity() ) {
      DBObject entity = this.prepareIdObject( key.getEntityKey() );
      if ( entity != null ) {
        BasicDBObject updater = new BasicDBObject();
        this.addSubQuery( "$unset", updater, key.getCollectionRole(), ONE );
        this.getCollection( key.getEntityKey() ).update( entity, updater, true, false );
View Full Code Here

    }
  }

  @Override
  public boolean isStoredInEntityStructure(AssociationKey associationKey, AssociationContext associationContext) {
    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( associationKey, associationContext );
    return storageStrategy.isEmbeddedInEntity();
  }
View Full Code Here

TOP

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

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.