Package org.hibernate.ogm.grid

Examples of org.hibernate.ogm.grid.RowKey


    for ( int i = 0; i < columnNames.length; i++ ) {
      String columnName = columnNames[i];
      columnValues[i] = associationKey.getMetadata().isKeyColumn( columnName ) ? associationKey.getColumnValue( columnName ) : accessor.get( row, columnName );
    }

    return new RowKey( table , columnNames, columnValues, null );
  }
View Full Code Here


              includeColumns[propertyIndex],
              session
          );
    Object[] columnValues = LogicalPhysicalConverterHelper.getColumnValuesFromResultset( tuple, rowKeyColumnNames );
    EntityKey targetKey = associationPersister.createTargetKey( rowKeyColumnNames, columnValues );
    final RowKey rowKey = new RowKey( persister.getTableName(), rowKeyColumnNames, columnValues, targetKey );

    Tuple assocEntryTuple = associationPersister.createAndPutAssociationTuple( rowKey );
    for ( String column : tuple.getColumnNames() ) {
      assocEntryTuple.put( column, tuple.get( column ) );
    }
View Full Code Here

    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() )
          .addColumns( buildRowKeyColumnNamesForStarToOne( persister, propertyColumnNames ) )
          .values( tupleKey )
          .entityKey( associationPersister.createTargetKey( rowKeyColumnNames, tupleKey ) )
          .build();
View Full Code Here

    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

      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

          .key( entityId )
          .inverse();

      // 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 = updateRowKeyEntityKey( rowKey, associationPersister );
        Tuple assocTuple = associationPersister.createAndPutAssociationTuple( inverseRowKey );
        for ( String columnName : tuple.getColumnNames() ) {
          assocTuple.put( columnName, tuple.get( columnName ) );
        }
        associationPersister.getAssociation().put( inverseRowKey, assocTuple );
      }
      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 = updateRowKeyEntityKey( rowKey, associationPersister );
        associationPersister.getAssociation().remove( inverseRowKey );
      }
      else {
        throw new AssertionFailure( "Unknown action type: " + action );
      }
View Full Code Here

    }
  }

  private RowKey updateRowKeyEntityKey(RowKey rowKey, AssociationPersister associationPersister) {
    EntityKey targetKey = associationPersister.createTargetKey( rowKey.getColumnNames(), rowKey.getColumnValues() );
    return new RowKey( rowKey.getTable(), rowKey.getColumnNames(), rowKey.getColumnValues(), targetKey );
  }
View Full Code Here

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

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

  private final Map<RowKey, Tuple> tuples = new HashMap<RowKey, Tuple>();

  public Neo4jAssociationSnapshot(Node ownerNode, AssociationKey associationKey) {
    for ( Relationship relationship : relationships( ownerNode, associationKey ) ) {
      RowKey rowKey = convert( associationKey, relationship );
      Tuple tuple = new Tuple( new Neo4jTupleSnapshot( relationship ) );
      tuples.put( rowKey, tuple );
    }
  }
View Full Code Here

      if ( container.hasProperty( columnName ) ) {
        values[i] = container.getProperty( columnName );
      }
    }

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

TOP

Related Classes of org.hibernate.ogm.grid.RowKey

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.