Spring Data Neo4j

org.springframework.data.neo4j.cross_store.support.node
Class CrossStoreNodeEntityInstantiator

java.lang.Object
  extended by org.springframework.data.neo4j.cross_store.support.node.CrossStoreNodeEntityInstantiator
All Implemented Interfaces:
EntityInstantiator<org.neo4j.graphdb.Node>

public class CrossStoreNodeEntityInstantiator
extends Object
implements EntityInstantiator<org.neo4j.graphdb.Node>

Entity instantiator for Node entities that takes into account that the entity is persisted in a JPA store as well.

Since:
02.10.2010
Author:
Michael Hunger

Constructor Summary
CrossStoreNodeEntityInstantiator(NodeEntityInstantiator delegate, javax.persistence.EntityManagerFactory entityManagerFactory)
           
 
Method Summary
<T> T
createEntityFromState(org.neo4j.graphdb.Node n, Class<T> entityClass, MappingPolicy mappingPolicy)
          Takes the JPA id stored in the "FOREIGN_ID" property of the node for a EntityManager.find(Class, Object) operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossStoreNodeEntityInstantiator

public CrossStoreNodeEntityInstantiator(NodeEntityInstantiator delegate,
                                        javax.persistence.EntityManagerFactory entityManagerFactory)
Method Detail

createEntityFromState

public <T> T createEntityFromState(org.neo4j.graphdb.Node n,
                                   Class<T> entityClass,
                                   MappingPolicy mappingPolicy)
Takes the JPA id stored in the "FOREIGN_ID" property of the node for a EntityManager.find(Class, Object) operation. If the entity is found its instance is associated with the graph node and returned otherwise a new node entity instance for this node is created by the original EntityInstantiator.

Specified by:
createEntityFromState in interface EntityInstantiator<org.neo4j.graphdb.Node>
Type Parameters:
T - generic type of the entity
Parameters:
n - Node to instantiate an entity for
entityClass - type of the entity

Spring Data Neo4j

Copyright © 2013 SpringSource. All Rights Reserved.