Package org.hibernate.ogm.datastore.spi

Examples of org.hibernate.ogm.datastore.spi.Association


          this.getCollection( key.getEntityKey() ).update( entity, updater, true, false, writeConcern );
          //adding assoc after update because the query takes the whole object today
          addEmptyAssociationField( key, entity );
        }
      }
      return new Association( new MongoDBAssociationSnapshot( entity, key, storageStrategy ) );
    }
    DBCollection associations = getAssociationCollection( key, storageStrategy );
    DBObject assoc = associationKeyToObject( key, storageStrategy );

    assoc.put( ROWS_FIELDNAME, Collections.EMPTY_LIST );

    associations.insert( assoc, writeConcern );

    return new Association( new MongoDBAssociationSnapshot( assoc, key, storageStrategy ) );
  }
View Full Code Here


      if ( association != null ) {
        couchDBAssociation = CouchDBAssociation.fromAssociationDocument( association );
      }
    }

    return couchDBAssociation != null ? new Association( new CouchDBAssociationSnapshot( couchDBAssociation, key ) ) : null;
  }
View Full Code Here

    else {
      AssociationDocument association = new AssociationDocument( Identifier.createAssociationId( key ) );
      couchDBAssociation = CouchDBAssociation.fromAssociationDocument( association );
    }

    return new Association( new CouchDBAssociationSnapshot( couchDBAssociation, key ) );
  }
View Full Code Here

  }

  @Override
  public Association getAssociation(AssociationKey key, AssociationContext associationContext) {
    Map<RowKey, Map<String, Object>> associationMap = provider.getAssociation( key );
    return associationMap == null ? null : new Association( new MapAssociationSnapshot( associationMap ) );
  }
View Full Code Here

  @Override
  public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
    Map<RowKey, Map<String, Object>> associationMap = new HashMap<RowKey, Map<String,Object>>();
    provider.putAssociation( key, associationMap );
    return new Association( new MapAssociationSnapshot( associationMap ) );
  }
View Full Code Here

        .gridDialect( gridDialect )
        .keyGridType( getKeyGridType() )
        .associationKeyMetadata( associationKeyMetadata )
        .collectionPersister( this );

    final Association collectionMetadata = associationPersister.getAssociationOrNull();
    return collectionMetadata == null ? 0 : collectionMetadata.size();
  }
View Full Code Here

          .keyGridType( getKeyGridType() )
          .associationKeyMetadata( associationKeyMetadata )
          .collectionPersister( this )
          .session( session );

      Association association = associationPersister.getAssociationOrNull();

      if ( association != null ) {
        // shortcut to avoid loop if we can
        if ( associationType != AssociationType.OTHER ) {
          for ( RowKey assocEntryKey : association.getKeys() ) {
            // we unfortunately cannot mass change the update of the associated entity
            updateInverseSideOfAssociationNavigation(
                session,
                null,
                association.get( assocEntryKey ),
                Action.REMOVE,
                assocEntryKey
                );
          }
        }
        association.clear();

        if ( associationPersister.hostingEntityRequiresReadAfterUpdate() ) {
          Object owner = session.getPersistenceContext().getCollectionOwner( id, this );
          associationPersister.hostingEntity( owner );
        }
View Full Code Here

    if ( association == null ) {
      // Compute bi-directionality first
      AssociationKey key = getAssociationKey();
      if ( isBidirectional == Boolean.FALSE ) {
        //fake association to prevent unidirectional associations to keep record of the inverse side
        association = new Association();
      }
      else {
        association = gridDialect.getAssociation( key, getAssociationContext() );
        if (association == null) {
          association = gridDialect.createAssociation( key, getAssociationContext() );
View Full Code Here

      return null;
    }
    else {
      @SuppressWarnings("unchecked")
      Map<SerializableKey, Map<String, Object>> associationRows = (Map<SerializableKey, Map<String, Object>>) element.getObjectValue();
      return new Association( new SerializableMapAssociationSnapshot( associationRows ) );
    }
  }
View Full Code Here

  @Override
  public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
    final Cache<SerializableKey> associationCache = datastoreProvider.getAssociationCache();
    Map<SerializableKey, Map<String, Object>> association = new HashMap<SerializableKey, Map<String, Object>>();
    associationCache.put( new Element( new SerializableKey( key ), association ) );
    return new Association( new SerializableMapAssociationSnapshot( association ) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.datastore.spi.Association

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.