Skip to content

Neo4jTemplate.DefaultExecutableQuery.getSingleResult() always executes in non-readonly transaction #2953

Open
@mkoertgen

Description

When activating Neo4jTransactionManager.setValidateExistingTransaction(true) a simple findById() will result in an IllegalStateException. This is due to getSingleResult() always executing in the default transactional-template

https://github.com/spring-projects/spring-data-neo4j/blob/main/src/main/java/org/springframework/data/neo4j/core/Neo4jTemplate.java#L1277

whereas the outer call findById() executes in a readonly-transaction.

https://github.com/spring-projects/spring-data-neo4j/blob/main/src/main/java/org/springframework/data/neo4j/core/Neo4jTemplate.java#L338

How to reproduce:

  1. activate transaction validation as described in @michael-simons tips (see below)
  2. call findById() on a neo4j-template or -repository

See also

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions