Reputation: 793
I'm working with Spring Data Neo4j 4 and have the following user entity
@NodeEntity
public class User{
private Long id;
private String username;
//Getter, Setter
}
Using the Neo4j GraphRepository, i first create the user in one transaction and later delete him in a second transaction. Working with the standalone Neo4j server on localhost:7474 i get no result when running "MATCH (n) return n" but when i run the findOne(Long id) method of the GraphRepository using the id of the User i just deleted, i get the user, i just deleted returned. Is there some kind of behavior involved i don't understand?
Regards Urr4
Edit: My application class
@SpringBootApplication(scanBasePackages = {/.../})
@EnableNeo4jRepositories(basePackages = {/.../})
@EnableTransactionManagement
public class MyApplication extends Neo4jConfiguration {
public static void main(String[] args) {
SpringApplication.run(TSApplication.class, args);
}
@Override
@Bean
public Neo4jServer neo4jServer() {
return new RemoteServer(/.../);
}
@Override
@Bean
public SessionFactory getSessionFactory() {
return new SessionFactory("/.../);
}
}
Upvotes: 0
Views: 149
Reputation: 793
After Michaels comment, i've googled a bit and added the following to my Controller:
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RuntimeException.class)
Afterwards it worked - Thank you all :)
Upvotes: 0