Package org.hibernate.ogm.datastore.spi

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


  // At the moment we only support the case where one entity type is returned
  private List<Object> listOfEntities(SessionImplementor session, Type[] resultTypes, ClosableIterator<Tuple> tuples) {
    List<Object> results = new ArrayList<Object>();
    Class<?> returnedClass = resultTypes[0].getReturnedClass();
    while ( tuples.hasNext() ) {
      Tuple tuple = tuples.next();
      OgmLoader loader = createLoader( session, returnedClass );
      results.add( entity( session, tuple, loader ) );
    }
    return results;
  }
View Full Code Here


  }

  private List<Object> listOfArrays(SessionImplementor session, Iterator<Tuple> tuples) {
    List<Object> results = new ArrayList<Object>();
    while ( tuples.hasNext() ) {
      Tuple tuple = tuples.next();
      Object[] entry = new Object[queryReturnTypes.length];

      int i = 0;
      for ( Type type : queryReturnTypes ) {
        GridType gridType = typeTranslator.getType( type );
View Full Code Here

    Map<String, Object> entityMap = provider.getEntityTuple( key );
    if ( entityMap == null ) {
      return null;
    }
    else {
      return new Tuple( new MapTupleSnapshot( entityMap ) );
    }
  }
View Full Code Here

  @Override
  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    HashMap<String,Object> tuple = new HashMap<String,Object>();
    provider.putEntity( key, tuple );
    return new Tuple( new MapTupleSnapshot( tuple ) );
  }
View Full Code Here

    provider.removeAssociation( key );
  }

  @Override
  public Tuple createTupleAssociation(AssociationKey associationKey, RowKey rowKey) {
    return new Tuple();
  }
View Full Code Here

  public void forEachTuple(Consumer consumer, EntityKeyMetadata... metadatas) {
    Map<EntityKey, Map<String, Object>> entityMap = provider.getEntityMap();
    for ( EntityKey key : entityMap.keySet() ) {
      for ( EntityKeyMetadata metadata : metadatas ) {
        if ( key.getTable().equals( metadata.getTable() ) ) {
          consumer.consume( new Tuple( new MapTupleSnapshot( entityMap.get( key ) ) ) );
        }
      }
    }
  }
View Full Code Here

  }

  @Override
  public Tuple get(RowKey column) {
    Map<String, Object> rawResult = associationMap.get( column );
    return rawResult != null ? new Tuple( new MapTupleSnapshot( rawResult ) ) : null;
  }
View Full Code Here

  }

  @Override
  public Tuple get(RowKey rowKey) {
    AssociationRow<?> row = rows.get( rowKey );
    return row != null ? new Tuple( row ) : null;
  }
View Full Code Here

        .associationKeyMetadataassociationKeyMetadata )
        .keyColumnValues( newColumnValue )
        .session( session )
        //does not set .collectionPersister as it does not make sense here for a ToOne or a unique key
        .propertyType( persister.getPropertyTypes()[propertyIndex] );
    Tuple tuple = new Tuple();
    //add the id column
    final String[] identifierColumnNames = persister.getIdentifierColumnNames();
    gridIdentifierType.nullSafeSet( tuple, id, identifierColumnNames, session );
    //add the fk column
    gridPropertyTypes[propertyIndex].nullSafeSet(
              tuple,
              fields[propertyIndex],
              propertyColumnNames,
              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 ) );
    }

    associationPersister.flushToCache();
  }
View Full Code Here

        .keyColumnValues( oldColumnValue )
        .session( session )
        //does not set .collectionPersister as it does not make sense here for a ToOne or a unique key
        .propertyType( persister.getPropertyTypes()[propertyIndex] );
    //add fk column value in TupleKey
    Tuple tupleKey = new Tuple();
    for (int index = 0 ; index < propertyColumnNames.length ; index++) {
      tupleKey.put( propertyColumnNames[index], oldColumnValue[index] );
    }
    //add id value in TupleKey
    gridIdentifierType.nullSafeSet( tupleKey, id, persister.getIdentifierColumnNames(), session );

    Association propertyValues = associationPersister.getAssociation();
View Full Code Here

TOP

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