Showing results for 
Search instead for 
Did you mean: 

@Properties how do I delete an item from a node


I have this map setup:
private Map<String, String> alternateIds = new HashMap<>();

I want to be able to remove items and I thought I would be able to just do something simple like this:
public void setAlternateIds(Map<String, String> alternateIds) {
this.alternateIds = alternateIds;

But when I do that and my map on the actual node has more items in it. They stay on the node and are never wiped out. Any ideas on how I can delete an item from this?



I have also tried specifically removing all items from the map on my Entity and then saving. Still seems as those any item in the map stays in the graph

I can indeed do something like this in cypher tho

match (n) where n._id ="17fa667f-d004-4a52-8715-6ab2e779d5e9" remove n.alternateIds.ECRM_ID remove n.alternateIds.GLOBAL remove n.alternateIds.SOURCE_ID remove n.alternateIds.CLASSIC_NODE_ID return n

and remove each item manually

I'm sad to say that this is probably a bug. I can reproduce the behavior with our issue template.

@gerrit.meier Please let us know what you think. If you agree that the properties should be deleted, I'll create a bug.


Yes I have seen this behaviour before and I am 99% sure that this is a bug.

Related StackOverflow question:

Will be fixed in 3.2 and probably in 3.1.6 as well.

Node Link

Still not working using spring-data-neo4j-2.2.7.RELEASE with neo4j-ogm-core-3.2.x as transitive dependency. Method I am using is

Edit: version I am talking about is org.springframework.boot:spring-boot-starter-data-neo4j:2.2.7.RELEASE

As Michael already asked for here: @Properties in a Map attribute of a @NodeEntity cannot be deleted. · Issue #518 · neo4j/neo4j-ogm · ...
A reproducer would be helpful for us. (And please no cross-posting)
Did you mean Spring Data Neo4j 5.2.7? Because 2.2.7 does not really make a lot of sense.

Node Link

Correct @gerrit.meier, Spring Data Neo4j 5.2.7 is the version. And unfortunately I don't have handy reproducible version. Just wanted to know if that is something you tested - that is, without using Session object, thanks.

Problem was on our side. We were using session.clear() in between operations. There is nothing to be concerned of @gerrit.meier and @michael.simons.

Sorry for cross-posting and thanks.

Thanks for your feedback, @lorenzo.valente.91 much appreciated.

Yes indeed, session.clear() is indeed dangerous in that regard: It demarks the transaction boundary and I agree, it's to easy to nuke it away.

Glad you figured it out.

Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.