Skip to content

Bug in connecting objects #2318

@shayantabrizi

Description

@shayantabrizi

It seems that there is something wrong which causes this code to behave nondeterministically and sometimes wrong.

        final C c = new C("att");
        final B b = new B(List.of(new B.C2(c)));
        final A a = new A(List.of(c), List.of(b));

        a.getCs().forEach(definition -> template.save(definition));
        a.getBs().forEach(definition -> template.save(definition));
        template.save(a);

        final Optional<Map<String, Object>> one = client.query("Match (n{id:'att'})-[r]-(m:A) return count(r)").fetch().one();
        System.out.println(one.get().get("count(r)"));

a has a member cs which includes a C object. However, sometimes a link is created between a and c (thus, printing 1) and sometimes no link is created between them (thus, printing 0).

Just run the code several times and see what is printed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions