spring-projects / spring-data-neo4j

Provide support to increase developer productivity in Java when using Neo4j. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
http://spring.io/projects/spring-data-neo4j
Apache License 2.0
828 stars 620 forks source link

DynamicLabels include non-dynamic label #2619

Closed SaschaPeukert closed 1 year ago

SaschaPeukert commented 1 year ago

Given:

@Node("Metric")
public abstract class Metric {
    @DynamicLabels
    public List<String> dynamicLabels;

    ...
}

@Node("Counter")
@Value
public class CounterMetric extends Metric {
    ...
}

And a test something like this:

...

var c = new CounterMetric(...);
c.dynamicLabels.add("Test");
save(c)
...
var retrievedCounter = load(counter)
...

It appears that dynamicLabels now include "Test" and "Counter" which is not ideal.

Seen with spring-boot 2.6.13 which uses spring-data-neo4j 6.2.9, I think

SaschaPeukert commented 1 year ago

Update: from what I see in our tests, this only happens sometimes (25% - 50% of runs), making it very annoying to deal with

michael-simons commented 1 year ago

IDK yet if relevant or not, but do these entities have @Id @GeneratedValue Long ids (internal neo4j) or are you using UUID or similar?

michael-simons commented 1 year ago

Thanks @SaschaPeukert for the report. This is fixed now.