diff --git a/pom.xml b/pom.xml index dbb1fd6b6..69fd3d8c0 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ multi - 3.2.17 + 3.2.18 2.3.6.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 3c19e4cd2..1084072b3 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 @@ -673,6 +673,52 @@ public class MoviesIntegrationTests { assertThat(foundUser.isEmpty()).isTrue(); } + @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<>();