org.springframework.data.graph.neo4j.support.node
Class PartialNodeEntityInstantiator
java.lang.Object
org.springframework.data.graph.neo4j.support.node.PartialNodeEntityInstantiator
- All Implemented Interfaces:
- org.springframework.data.persistence.EntityInstantiator<NodeBacked,org.neo4j.graphdb.Node>
public class PartialNodeEntityInstantiator
- extends Object
- implements org.springframework.data.persistence.EntityInstantiator<NodeBacked,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
Method Summary |
|
createEntityFromState(org.neo4j.graphdb.Node n,
Class<T> entityClass)
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 |
PartialNodeEntityInstantiator
public PartialNodeEntityInstantiator(NodeEntityInstantiator delegate,
javax.persistence.EntityManagerFactory entityManagerFactory)
createEntityFromState
public <T extends NodeBacked> T createEntityFromState(org.neo4j.graphdb.Node n,
Class<T> entityClass)
- 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 org.springframework.data.persistence.EntityInstantiator<NodeBacked,org.neo4j.graphdb.Node>
- Type Parameters:
T
- generic type of the entity- Parameters:
n
- Node to instantiate an entity forentityClass
- type of the entity
- Returns:
Copyright © 2011. All Rights Reserved.