Examples of RowKey


Examples of org.hibernate.ogm.model.key.spi.RowKey

    for ( int i = 0; i < columnNames.length; i++ ) {
      values[i] = snapshot.get( columnNames[i] );
    }

    return new RowKey( columnNames, values );
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.RowKey

    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

Examples of org.hibernate.ogm.model.key.spi.RowKey

  @Override
  public Set<RowKey> getRowKeys() {
    Set<RowKey> rowKeys = new HashSet<RowKey>( associationMap.size() );

    for ( SerializableRowKey key : associationMap.keySet() ) {
      rowKeys.add( new RowKey( key.getColumnNames(), key.getColumnValues() ) );
    }

    return rowKeys;
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.RowKey

    while ( entries.hasNext() ) {
      Object entry = entries.next();
      if ( collection.needsUpdating( entry, i, elementType ) ) {
        // find the matching element
        RowKey assocEntryKey = getTupleKeyForUpdate( key, collection, session, i, entry, associationPersister );
        Tuple assocEntryTuple = associationPersister.getAssociation().get( assocEntryKey );
        if ( assocEntryTuple == null ) {
          throw new AssertionFailure( "Updating a collection tuple that is not present: " + "table {" + getTableName() + "} collectionKey {" + key + "} entry {" + entry + "}" );
        }
        // update the matching element
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.RowKey

      if ( deletes.hasNext() ) {
        int count = 0;
        while ( deletes.hasNext() ) {
          Object entry = deletes.next();
          // find the matching element
          RowKey assocEntryKey = getTupleKeyForDelete( id, collection, session, entry, deleteByIndex, associationPersister );
          Tuple assocEntryTuple = associationPersister.getAssociation().get( assocEntryKey );
          if ( assocEntryTuple == null ) {
            throw new AssertionFailure( "Deleting a collection tuple that is not present: " + "table {" + getTableName() + "} collectionKey {" + id + "} entry {" + entry + "}" );
          }
          // delete the tuple
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.RowKey

      AssociationPersister associationPersister = inverseCollectionPersister.getAssociationPersister( entity, elementColumnValues, session );

      // TODO what happens when a row should be *updated* ?: I suspect ADD works OK as it's a put()
      if ( action == Action.ADD ) {
        RowKey inverseRowKey = getInverseRowKey( associationRow );

        Tuple inverseAssociationRow = new Tuple();
        associationPersister.getAssociation().put( inverseRowKey, inverseAssociationRow );
        for ( String columnName : associationRow.getColumnNames() ) {
          inverseAssociationRow.put( columnName, associationRow.get( columnName ) );
        }
        associationPersister.getAssociation().put( inverseRowKey, inverseAssociationRow );
      }
      else if ( action == Action.REMOVE ) {
        // we try and match the whole tuple as it should be on both sides of the navigation
        if ( rowKey == null ) {
          throw new AssertionFailure( "Deleting a collection tuple that is not present: " + "table {"
              + getTableName() + "} key column names {" + Arrays.toString( elementColumnNames )
              + "} key column values {" + Arrays.toString( elementColumnValues ) + "}" );
        }

        RowKey inverseRowKey = getInverseRowKey( associationRow );
        associationPersister.getAssociation().remove( inverseRowKey );
      }
      else {
        throw new AssertionFailure( "Unknown action type: " + action );
      }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.RowKey

    for ( int i = 0; i < inverseRowKeyColumnNames.length; i++ ) {
      columnValues[i] = associationRow.get( inverseRowKeyColumnNames[i] );
    }

    return new RowKey( inverseRowKeyColumnNames, columnValues );
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.RowKey

    input.readInt();

    String[] columnNames = (String[]) input.readObject();
    Object[] values = (Object[]) input.readObject();

    return new RowKey( columnNames, values );
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.RowKey

    for (int index = 0 ; index < length ; index++ ) {
      columnValuesArray[index] = tuple.get( columnNamesArray[index] );
    }

    return new RowKey( columnNamesArray, columnValuesArray );
  }
View Full Code Here

Examples of org.hibernate.ogm.model.key.spi.RowKey

    StringBuilder sb = new StringBuilder( "Association[");

    Iterator<RowKey> rowKeys = association.getKeys().iterator();

    while ( rowKeys.hasNext() ) {
      RowKey rowKey = rowKeys.next();
      sb.append( toShortString( rowKey ) ).append( "=" ).append( toShortString( association.get( rowKey ) ) );

      if ( rowKeys.hasNext() ) {
        sb.append( ",\n" );
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.