Package org.hibernate.ogm.model.spi

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


  }

  private ClosableIterator<Tuple> doCount(MongoDBQueryDescriptor query, DBCollection collection) {
    long count = collection.count( query.getCriteria() );
    MapTupleSnapshot snapshot = new MapTupleSnapshot( Collections.<String, Object>singletonMap( "n", count ) );
    return CollectionHelper.newClosableIterator( Collections.singletonList( new Tuple( snapshot ) ) );
  }
View Full Code Here


    }
  }

  private void executeBatchUpdate(Map<DBCollection, BatchInsertionTask> inserts, UpdateTupleOperation tupleOperation) {
    EntityKey entityKey = tupleOperation.getEntityKey();
    Tuple tuple = tupleOperation.getTuple();
    BatchableMongoDBTupleSnapshot snapshot = (BatchableMongoDBTupleSnapshot) tupleOperation.getTuple().getSnapshot();
    WriteConcern writeConcern = getWriteConcern( tupleOperation.getTupleContext() );

    if ( INSERT == snapshot.getOperationType() && columnNamesAllowBatchInsert( tupleOperation ) ) {
      prepareForInsert( inserts, snapshot, entityKey, tuple, writeConcern );
View Full Code Here

    }

    @Override
    public Tuple next() {
      DBObject dbObject = cursor.next();
      return new Tuple( new MongoDBTupleSnapshot( dbObject, metadata ) );
    }
View Full Code Here

    }
  }

  @SuppressWarnings("unchecked")
  private Tuple createTuple(final Element element) {
    return new Tuple( new MapTupleSnapshot( (Map<String, Object>) element.getObjectValue() ) );
  }
View Full Code Here

  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    final Cache<SerializableEntityKey> entityCache = datastoreProvider.getEntityCache();
    final HashMap<String, Object> tuple = new HashMap<String, Object>();
    entityCache.put( new Element( new SerializableEntityKey( key ), tuple ) );

    return new Tuple( new MapTupleSnapshot( tuple ) );
  }
View Full Code Here

  @Override
  public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
    EntityDocument entity = getDataStore().getEntity( Identifier.createEntityId( key ) );
    if ( entity != null ) {
      return new Tuple( new CouchDBTupleSnapshot( entity.getProperties() ) );
    }

    return null;
  }
View Full Code Here

    return null;
  }

  @Override
  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    return new Tuple( new CouchDBTupleSnapshot( key ) );
  }
View Full Code Here

  private List<Object> getAssociationRows(Association association, AssociationKey associationKey) {

    List<Object> rows = new ArrayList<Object>( association.getKeys().size() );

    for ( RowKey rowKey : association.getKeys() ) {
      Tuple tuple = association.get( rowKey );

      String[] columnsToPersist = associationKey.getMetadata().getColumnsWithoutKeyColumns( tuple.getColumnNames() );

      // return value itself if there is only a single column to store
      if ( columnsToPersist.length == 1 ) {
        Object row = tuple.get( columnsToPersist[0] );
        rows.add( row );
      }
      else {
        Map<String, Object> row = new HashMap<String, Object>( columnsToPersist.length );
        for ( String columnName : columnsToPersist ) {
          row.put( columnName, tuple.get( columnName ) );
        }

        rows.add( row );
      }
    }
View Full Code Here

    FineGrainedAtomicMap<String, Object> atomicMap = AtomicMapLookup.getFineGrainedAtomicMap( cache, key, false );
    if ( atomicMap == null ) {
      return null;
    }
    else {
      return new Tuple( new InfinispanTupleSnapshot( atomicMap ) );
    }
  }
View Full Code Here

  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    //TODO we don't verify that it does not yet exist assuming that this has been done before by the calling code
    //should we improve?
    Cache<EntityKey, Map<String, Object>> cache = provider.getCache( ENTITY_STORE );
    FineGrainedAtomicMap<String,Object> atomicMap =  AtomicMapLookup.getFineGrainedAtomicMap( cache, key, true );
    return new Tuple( new InfinispanTupleSnapshot( atomicMap ) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.model.spi.Tuple

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.