diff --git a/pom.xml b/pom.xml
index 753e64995..ee5c7c34e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,7 @@
multi
- 3.2.17
+ 3.2.18
2.2.12.BUILD-SNAPSHOT
diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/examples/movies/MoviesIntegrationTests.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/examples/movies/MoviesIntegrationTests.java
index fe879964d..bc2956651 100644
--- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/examples/movies/MoviesIntegrationTests.java
+++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/examples/movies/MoviesIntegrationTests.java
@@ -670,6 +670,52 @@ public class MoviesIntegrationTests {
assertTrue(foundUser.isEmpty());
}
+ @Test // DATAGRAPH-1407
+ public void shouldRemoveGenreFromUserDespiteReadonlyCustomQuery() {
+ transactionTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ public void doInTransactionWithoutResult(TransactionStatus status) {
+ User michal = new User("Michal");
+ Genre drama = new Genre("Drama");
+ michal.interestedIn(drama);
+
+ userRepository.save(michal);
+
+ michal.notInterestedIn(drama);
+
+ userRepository.getAllUsers();
+ userRepository.save(michal);
+ }
+ });
+
+ assertThat(graphDatabaseService)
+ .containsNode("MATCH (m:User:Person {name:'Michal'})," + "(g:Genre {name:'Drama'})" +
+ " WHERE NOT (m)-[:INTERESTED]->(g) RETURN m AS n");
+ }
+
+ @Test // DATAGRAPH-1407
+ public void shouldRemoveGenreFromUserDespiteReadonlyCustomQueryWithQueryResult() {
+ transactionTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ public void doInTransactionWithoutResult(TransactionStatus status) {
+ User michal = new User("Michal");
+ Genre drama = new Genre("Drama");
+ michal.interestedIn(drama);
+
+ userRepository.save(michal);
+
+ michal.notInterestedIn(drama);
+
+ userRepository.retrieveAllUsersAndTheirAges();
+ userRepository.save(michal);
+ }
+ });
+
+ assertThat(graphDatabaseService)
+ .containsNode("MATCH (m:User:Person {name:'Michal'})," + "(g:Genre {name:'Drama'})" +
+ " WHERE NOT (m)-[:INTERESTED]->(g) RETURN m AS n");
+ }
+
private void createUserForContainsTest() {
User user = new User("Somebody");
Set emailAddresses = new HashSet<>();