Hi Pulkit,
Would you be able to give us a simple test that demonstrates the issue?
Thanks
Luanne
On Sun, May 1, 2016 at 9:47 PM, pulkit mehra wrote:
> I am using spring-data-4.1.1 & Neo4j 2.3.2 with ogm annotations
>
> Below is my entity
>
> @NodeEntity(label = "Component")
> public class Component extends BaseEntity {
> .
>
> @Relationship(type = Relation.LINK_TO)
> private Set links = new HashSet<>();
>
> @Relationship(type = Relation.PARENT)
> private Set parents = new HashSet<>();
> .
> .
>
>
> }
>
> And Link class
>
> @RelationshipEntity(type = Relation.LINK_TO)
> public class Link extends BaseEntity {
>
> @Property(name = "isSelfLink")
> private boolean isSelfLink;
>
> @StartNode
> private Component component;
>
> @EndNode
> private Component linkComponent;
> }
>
> I've removed getter/setter/hashcode/equals for keeping it clean
>
> Now, here is my code to add two component parent/child and a Link
>
> Component parentcomp = new Component(1, name);
> Component childcomp = new Component(2, name);
> childcomp.getParents().add(parent);
>
> Link link = new Link();
> link.setComponent(parentcomp);
> link.setLinkComponent(childcomp);
> parentcomp.getLinks().add(link);
>
> componentRepository.save(parentcomp,-1);
>
>
> Now, as per the logic
>
> 1. object parentcomp property 'parent' should be empty
> 2. object childcomp property 'parent' should have parentcomp object
> 3. And parentcomp property 'links' should have childcomp
>
> (parentcomp)LINKS_TO>(childcomp)
>
> (parentcomp)
> Note: My equirement is such that we need two way relationship..
>
> But, below is the result when I load parent or child entity
>
> 1. object **parentcomp** property 'parent' has both childcomp,parentcomp
> instead of empty
> 2. object **childcomp** property 'parent' has both childcomp,parentcomp
> instead of only parentcomp
>
> This behavior persist until a Neo4j sessions clears out internally. After
> some time(or after app restart) the mappings shows up correctly.
>
> I tried cleaning up the session using neo4joperations.clear() still
> problem persists. But if I query
>
> match (c:Component)-[:PARENT]->(p) where c.componentId = {0} return p
>
> results are correct.
>
> I am not sure how to solve this problem...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.