Package org.hibernate.ogm.datastore.neo4j.dialect.impl

Source Code of org.hibernate.ogm.datastore.neo4j.dialect.impl.NodesTupleIterator

/*
* Hibernate OGM, Domain model persistence for NoSQL datastores
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.ogm.datastore.neo4j.dialect.impl;

import java.util.Map;

import org.hibernate.ogm.model.spi.Tuple;
import org.neo4j.cypher.javacompat.ExecutionResult;
import org.neo4j.graphdb.Node;

/**
* Iterates over the result of a native query when each result is a neo4j node.
* This is the case when the result of native query is mapped by an entity type.
*
* @author Davide D'Alto
*/
public class NodesTupleIterator extends MapsTupleIterator {

  public NodesTupleIterator(ExecutionResult result) {
    super( result );
  }

  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 ) );
  }
}
TOP

Related Classes of org.hibernate.ogm.datastore.neo4j.dialect.impl.NodesTupleIterator

TOP
Copyright © 2018 www.massapi.com. 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.