Google Groups

Re: [Neo4j] spring-data-neo4j depth on persistance


Peter Neubauer Apr 28, 2012 3:42 AM
Posted in group: Neo4j

Michael,
Do you have any input here?

On Apr 26, 2012 8:04 PM, "Fredrik Hultin" <fredrik...@collabra.se> wrote:
Hi,
found a funny problem with the spring-data-neo4j (2.1.0.M1), all
objects below are annotated with @NodeEntity:

Load an object:
-- MyObject obj = repo.findAll.single();

The object has a child with a list of grand children on which t we
want to add to:

-- obj.getChild().addChildren(new GrandChild());

and save
-- template.save(obj)
Now the new grand child will NOT be persisted! No error no nothing.

-- template.save(obj.getChild())
Still not working!

However:
-- Child child = obj.getChild();
-- template.save(child);
Saves the children as expected. As it looks like in the code the
getChild() method does some ajp lookups. This is maybe where the child
gets fetched from the store?

I guess this has something to do with the dirty flag of the child
object (to much ajp code for tonight).
What is the expected behavior? From hibernate I would have expected my
full graph to be updated. Is there a way to control the save depth? By
only having one level the spring-data-neo4j becomes a little bit
useless since many object structures are deeper than that so I guess I
am doing something wrong here...

/Fredrik