Package org.hibernate.ogm.model.impl

Examples of org.hibernate.ogm.model.impl.RowKeyBuilder


    }
    return builder;
  }

  private RowKey getTupleKeyForUpdate(Serializable key, PersistentCollection collection, SessionImplementor session, int i, Object entry, AssociationPersister associationPersister) {
    RowKeyBuilder rowKeyBuilder = initializeRowKeyBuilder();
    Tuple tuple = new Tuple();
    if ( hasIdentifier ) {
      final Object identifier = collection.getIdentifier( entry, i );
      String[] names = { getIdentifierColumnName() };
      identifierGridType.nullSafeSet( tuple, identifier, names, session );
    }
    else {
      getKeyGridType().nullSafeSet( tuple, key, getKeyColumnNames(), session );
      // No need to write to where as we don't do where clauses in OGM :)
      if ( !isOneToMany() && hasIndex && !indexContainsFormula ) {
        Object index = collection.getIndex( entry, i, this );
        indexGridType.nullSafeSet( tuple, incrementIndexByBase( index ), getIndexColumnNames(), session );
      }
      else {
        final Object snapshotElement = collection.getSnapshotElement( entry, i );
        if ( elementIsPureFormula ) {
          throw new AssertionFailure( "cannot use a formula-based element in the where condition" );
        }
        getElementGridType().nullSafeSet( tuple, snapshotElement, getElementColumnNames(), session );
      }
    }
    rowKeyBuilder.values( tuple );
    return rowKeyBuilder.build();
  }
View Full Code Here


    rowKeyBuilder.values( tuple );
    return rowKeyBuilder.build();
  }

  private RowKey getTupleKeyForDelete(Serializable key, PersistentCollection collection, SessionImplementor session, Object entry, boolean findByIndex, AssociationPersister associationPersister) {
    RowKeyBuilder rowKeyBuilder = initializeRowKeyBuilder();
    Tuple tuple = new Tuple();
    if ( hasIdentifier ) {
      final Object identifier = entry;
      String[] names = { getIdentifierColumnName() };
      identifierGridType.nullSafeSet( tuple, identifier, names, session );
    }
    else {
      getKeyGridType().nullSafeSet( tuple, key, getKeyColumnNames(), session );
      // No need to write to where as we don't do where clauses in OGM :)
      if ( findByIndex ) {
        Object index = entry;
        indexGridType.nullSafeSet( tuple, incrementIndexByBase( index ), getIndexColumnNames(), session );
      }
      else {
        final Object snapshotElement = entry;
        if ( elementIsPureFormula ) {
          throw new AssertionFailure( "cannot use a formula-based element in the where condition" );
        }
        getElementGridType().nullSafeSet( tuple, snapshotElement, getElementColumnNames(), session );
      }
    }
    rowKeyBuilder.values( tuple );
    return rowKeyBuilder.build();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.model.impl.RowKeyBuilder

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.