Package org.hibernate.ogm.model.spi

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


    Object gridValue = convertToGridType( value, propertyType );
    return gridValue;
  }

  private Object convertToGridType(Object value, Type propertyType) {
    Tuple dummy = new Tuple();
    GridType gridType = typeTranslator().getType( propertyType );
    gridType.nullSafeSet( dummy, value, new String[] { "key" }, null );
    return dummy.get( "key" );
  }
View Full Code Here


    Object[] values = { 123, "Hello", 456L };

    EntityKey key = new EntityKey( keyMetadata, values );

    // when
    Tuple tuple = dialect1.createTuple( key, emptyTupleContext() );
    tuple.put( "foo", "bar" );
    dialect1.insertOrUpdateTuple( key, tuple, emptyTupleContext() );

    // then
    Tuple readTuple = dialect2.getTuple( key, null );
    assertThat( readTuple.get( "foo" ) ).isEqualTo( "bar" );
  }
View Full Code Here

    Object[] values = { 123, "Hello", 456L };

    AssociationKey key = new AssociationKey( keyMetadata, values, null );

    RowKey rowKey = new RowKey( columnNames, values );
    Tuple tuple = new Tuple();
    tuple.put( "zip", "zap" );

    // when
    Association association = dialect1.createAssociation( key, null );
    association.put( rowKey, tuple );
    dialect1.insertOrUpdateAssociation( key, association, null );

    // then
    Association readAssociation = dialect2.getAssociation( key, null );
    Tuple readKey = readAssociation.get( rowKey );
    assertThat( readKey ).isNotNull();
    assertThat( readKey.get( "zip" ) ).isEqualTo( "zap" );
  }
View Full Code Here

    return createTuple( entityNode, context );
  }

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

  public Tuple createTuple(EntityKey key, TupleContext tupleContext) {
    return new Tuple();
  }

  private static Tuple createTuple(Node entityNode, TupleContext tupleContext) {
    return new Tuple( new Neo4jTupleSnapshot( entityNode, tupleContext.getAllAssociatedEntityKeyMetadata(), tupleContext.getAllRoles() ) );
  }
View Full Code Here

    for ( EntityKeyMetadata entityKeyMetadata : entityKeyMetadatas ) {
      ResourceIterator<Node> queryNodes = entityQueries.get( entityKeyMetadata ).findEntities( executionEngine );
      try {
        while ( queryNodes.hasNext() ) {
          Node next = queryNodes.next();
          Tuple tuple = new Tuple( new Neo4jTupleSnapshot( next ) );
          consumer.consume( tuple );
        }
      }
      finally {
        queryNodes.close();
View Full Code Here

   * Returns a map with the named parameter values from the given parameters object, converted by the {@link GridType}
   * corresponding to each parameter type.
   */
  private Map<String, Object> getNamedParameterValuesConvertedByGridType(QueryParameters queryParameters) {
    Map<String, Object> parameterValues = new HashMap<String, Object>( queryParameters.getNamedParameters().size() );
    Tuple dummy = new Tuple();
    TypeTranslator typeTranslator = serviceRegistry.getService( TypeTranslator.class );

    for ( Entry<String, TypedValue> parameter : queryParameters.getNamedParameters().entrySet() ) {
      GridType gridType = typeTranslator.getType( parameter.getValue().getType() );
      gridType.nullSafeSet( dummy, parameter.getValue().getValue(), new String[]{ parameter.getKey() }, null );
      parameterValues.put( parameter.getKey(), dummy.get( parameter.getKey() ) );
    }

    return parameterValues;
  }
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

  protected Tuple convert(Map<String, Object> next) {
    return createTuple( (Node) next.values().iterator().next() );
  }

  private Tuple createTuple(Node node) {
    return new Tuple( new Neo4jTupleSnapshot( node ) );
  }
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.