Remove/Change secondary labels with Neo4j-OGM


(Martin Folke Emdal) #1

Hi again,
I've been having some trouble with changing the labels for my nodes with the neo4j-ogm framework. While using the @Labels annotation for a collection of labels I can load labels from the graph just fine, as well as store new labels, but if I try to remove a label the node is unchanged. I think I might be using the ogm framework wrong. Is there something else I should do if I need to change labels for node?
For instance if I have a node in the graph (myNode:A:B { id: "myId" }). This code below does not work:

@NodeEntity
public class A {
  @Id String id;
  @Labels List<String> labels;
}
---
A a = session.load(A.class, "myId");
a.labels.remove("B");
session.save(a);

The node will still have the label :B attached to it


(Michael Simons) #3

Thanks for reporting this. We track this here:

I agree, looks like bug.