I created a graph model with 2 classes Node and Element as follows:

public class Node {

 @RelatedTo(type = "ELEMENT", elementClass = Element.class, direction =
OUTGOING)
    private Set<Element> Element;


    public void addElement(Element e) {
        relateTo(e, Relationships.ELEMENT.toString());
    }

}

public class Element{

   public String name;

}
I want to create an in memory graph structure without persisting the nodes
as follows :

Node n = new Node();
n.addElement(new Element());

*However it throws an exception as the Node n has not been persisted so the
call to relateTo(..) fails. *

If instead I do
n.persist()
and then call addElement(..) it works fine as the aspect kicks in.

Any workaround for this ?  That is, is there a way I can still use the above
style without persisting the Node object ?


My application needs this as first I create a structure and persist it, and
then I create another structure to pass around some values to the persisted
structure when doing some computations.

-Karan
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to