Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-05-2018 06:27 AM
I have this map setup:
@Properties
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?
09-05-2018 08:42 AM
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
09-05-2018 01:43 PM
Hi,
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.
09-05-2018 02:05 PM
Yes I have seen this behaviour before and I am 99% sure that this is a bug.
Related StackOverflow question: https://stackoverflow.com/questions/51374111/how-to-remove-the-properties-of-map-in-neo4j/51391308
09-05-2018 02:18 PM
12-07-2018 08:15 AM
Will be fixed in 3.2 and probably in 3.1.6 as well.
02-28-2022 06:32 AM
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 repository.save()
Edit: version I am talking about is org.springframework.boot:spring-boot-starter-data-neo4j:2.2.7.RELEASE
02-28-2022 07:07 AM
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.
02-28-2022 07:11 AM
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.
02-28-2022 08:41 AM
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.
03-01-2022 12:07 AM
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.
All the sessions of the conference are now available online