Package org.hibernate.ogm.model.spi

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


    RowKey rowKey = new RowKey( columnNames, values );
    Tuple tuple = new Tuple();
    tuple.put( "zip", "zap" );

    // when
    Association association = dialect1.createAssociation( key, null );
    association.put( rowKey, tuple );
    dialect1.insertOrUpdateAssociation( key, association, null );

    // then
    Association readAssociation = dialect2.getAssociation( key, null );
    Tuple readKey = readAssociation.get( rowKey );
    assertThat( readKey ).isNotNull();
    assertThat( readKey.get( "zip" ) ).isEqualTo( "zap" );
  }
View Full Code Here


    Node entityNode = entityQueries.get( entityKey.getMetadata() ).findEntity( executionEngine, entityKey.getColumnValues() );
    GraphLogger.log( "Found owner node: %1$s", entityNode );
    if ( entityNode == null ) {
      return null;
    }
    return new Association(
        new Neo4jAssociationSnapshot(
            entityNode,
            associationKey,
            associationContext.getAssociationTypeContext().getAssociatedEntityKeyMetadata(),
            associationContext.getAssociationTypeContext().getRoleOnMainSide()
View Full Code Here

    );
  }

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

      return null;
    }
    else {
      @SuppressWarnings("unchecked")
      Map<SerializableRowKey, Map<String, Object>> associationRows = (Map<SerializableRowKey, 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<SerializableAssociationKey> associationCache = datastoreProvider.getAssociationCache();
    Map<SerializableRowKey, Map<String, Object>> association = new HashMap<SerializableRowKey, Map<String, Object>>();
    associationCache.put( new Element( new SerializableAssociationKey( key ), association ) );
    return new Association( new SerializableMapAssociationSnapshot( association ) );
  }
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

    EntityKey entityKey = createEntityKey( "user", new String[] { "id", "age" }, new Object[] { "17", 36 } );
    String collectionRole = "addresses";

    AssociationKey key = createAssociationKey( entityKey, collectionRole, tableName, columnNames, columnValues, rowKeyColumnNames );

    Association createAssociation = dialect.createAssociation( key, emptyAssociationContext() );

    assertThat( createAssociation.getSnapshot() ).isNotNull();
    assertThat( createAssociation.getSnapshot().getRowKeys() ).isEmpty();
  }
View Full Code Here

    dialect.insertOrUpdateTuple( entityKey, tuple, emptyTupleContext() );

    AssociationKey key = createAssociationKey(
        entityKey, "addresses", "user_address", new String[] { "user_id" }, new Object[] { "Emmanuel" }, rowKeyColumnNames
    );
    Association createAssociation = dialect.createAssociation( key, emptyAssociationContext() );

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put( "user_id", "Emmanuel" );
    properties.put( "addresses_id", 1 );
    Tuple associationTuple = new Tuple( new CouchDBTupleSnapshot( properties ) );

    RowKey rowKey = new RowKey( rowKeyColumnNames, rowKeyColumnValues );
    createAssociation.put( rowKey, associationTuple );
    dialect.insertOrUpdateAssociation( key, createAssociation, emptyAssociationContext() );

    Association actualAssociation = dialect.getAssociation( key, emptyAssociationContext() );
    assertThat( actualAssociation.get( rowKey ).hashCode() ).isNotNull();
  }
View Full Code Here

            null
        ),
        new Tuple( new MongoDBTupleSnapshot( null, null, null ) )
    );

    final Association association = getService( GridDialect.class ).getAssociation( associationKey, associationContext );
    final MongoDBAssociationSnapshot associationSnapshot = (MongoDBAssociationSnapshot) association.getSnapshot();
    final DBObject assocObject = associationSnapshot.getDBObject();
    this.checkLoading( assocObject );

    session.delete( mongodb );
    session.delete( infinispan );
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.model.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.