Package org.hibernate.ogm.datastore.spi

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


  }

  @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

      tupleKey.put( propertyColumnNames[index], oldColumnValue[index] );
    }
    //add id value in TupleKey
    gridIdentifierType.nullSafeSet( tupleKey, id, persister.getIdentifierColumnNames(), session );

    Association propertyValues = associationPersister.getAssociation();
    if ( propertyValues != null ) {
      //Map's equals operation delegates to all it's key and value, should be fine for now
      //this is a StarToOne case ie the FK is on the owning entity
      final RowKey matchingTuple = new RowKeyBuilder()
          .tableName( persister.getTableName() )
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

        .keyGridType( gridUniqueKeyType )
        //does not set .collectionPersister as it does not make sense here for an entity
        .associationKeyMetadata( associationKeyMetadata )
        .session( session )
        .propertyType( getPropertyTypes()[propertyIndex] );
    final Association ids = associationPersister.getAssociationOrNull();

    if (ids == null || ids.size() == 0 ) {
      return null;
    }
    else if (ids.size() == 1) {
      //EntityLoader#loadByUniqueKey uses a null object and LockMode.NONE
      //there is only one element in the list, so get the first
      Tuple tuple = ids.get( ids.getKeys().iterator().next() );
      final Serializable id = (Serializable) getGridIdentifierType().nullSafeGet( tuple, getIdentifierColumnNames(), session, null );
      return load( id, null, LockMode.NONE, session );
    }
    else {
      throw new AssertionFailure(
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

  public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
    Node entityNode = neo4jCRUD.findNode( associationKey.getEntityKey(), ENTITY );
    if ( entityNode == null ) {
      return null;
    }
    return new Association( new Neo4jAssociationSnapshot( entityNode, associationKey ) );
  }
View Full Code Here

    return new Association( new Neo4jAssociationSnapshot( entityNode, associationKey ) );
  }

  @Override
  public Association createAssociation(AssociationKey associationKey, AssociationContext associationContext) {
    return new Association();
  }
View Full Code Here

  public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext) {
    Node entityNode = neo4jCRUD.findNode( associationKey.getEntityKey(), ENTITY );
    if ( entityNode == null ) {
      return null;
    }
    return new Association( new Neo4jAssociationSnapshot( entityNode, associationKey ) );
  }
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.