{"action":"closed","issue":{"url":"https://api.github.com/repos/neo4j/neo4j-ogm/issues/147","repository_url":"https://api.github.com/repos/neo4j/neo4j-ogm","labels_url":"https://api.github.com/repos/neo4j/neo4j-ogm/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/neo4j/neo4j-ogm/issues/147/comments","events_url":"https://api.github.com/repos/neo4j/neo4j-ogm/issues/147/events","html_url":"https://github.com/neo4j/neo4j-ogm/issues/147","id":148142976,"number":147,"title":"OGM Entity cache prevents me from updating a Node in the database","user":{"login":"vicaba","id":2136777,"avatar_url":"https://avatars.githubusercontent.com/u/2136777?v=3","gravatar_id":"","url":"https://api.github.com/users/vicaba","html_url":"https://github.com/vicaba","followers_url":"https://api.github.com/users/vicaba/followers","following_url":"https://api.github.com/users/vicaba/following{/other_user}","gists_url":"https://api.github.com/users/vicaba/gists{/gist_id}","starred_url":"https://api.github.com/users/vicaba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicaba/subscriptions","organizations_url":"https://api.github.com/users/vicaba/orgs","repos_url":"https://api.github.com/users/vicaba/repos","events_url":"https://api.github.com/users/vicaba/events{/privacy}","received_events_url":"https://api.github.com/users/vicaba/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/neo4j/neo4j-ogm/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-04-13T18:24:21Z","updated_at":"2016-05-16T08:59:35Z","closed_at":"2016-05-16T08:59:35Z","body":"Hi,\r\n\r\nMy code converts an Entity in Neo4j to a domain object. Several operations are applied on the domain object (like removing relationships between other nodes) and then it gets converted back to a Neo4j annotated Entity to get updated (calling ```session.save```). The problem is that the Entity does not get modified in the database. I'm afraid it is because the OGM keeps a cache mapping between the nodeId and the reference to the retrieved object so when it detects that I save an object with a nodeId that is cached, it compares the old hashCode() with the new hashCode() and as it is the same object, the OGM detects no changes.\r\n\r\nLet me explain the same in another manner:\r\n\r\n1.  ```session.load```: Neo4j saves _id(3) -> objectRef(5)\r\n2. Translate Neo4j entity to another class\r\n3. Operate on the created class\r\n4. Convert object back to Neo4j Entity with _id(3): objectRef(10)\r\n5.  ```session.save```: Neo4j detects that the _id is 3 and then searches _id(3) in cache, returning objectRef(5) and compares the old hashCode with the new hashCode. As the objectRef(5) hasn't changed, Neo4j detects no changes.\r\n\r\nI think that this is what's happening and I would like to know if this is how the cache works and how can I get it solved (preferably without mixing the Neo4j Entity and the other class)\r\n\r\nThanks"}}