Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce reasonable transaction boundaries for multi query operations #2860

Closed
meistermeier opened this issue Feb 9, 2024 · 0 comments
Closed
Assignees

Comments

@meistermeier
Copy link
Collaborator

Be it save with relationships or loading of cyclic graph data, both operations will issue multiple queries.
If the user does not specify transactions via @Transactional or TransactionTemplate/TransactionalOperator, each query will happen in its own transaction. To avoid this surprising scenario for the users we should create transactions around those batches of operations if the user does not specify a broader transactional scope.

@meistermeier meistermeier self-assigned this Feb 9, 2024
@meistermeier meistermeier added this to the 7.2.3 (2023.1.3) milestone Feb 9, 2024
meistermeier added a commit that referenced this issue Feb 12, 2024
If no transactional boundaries were set by the user,
Spring Data Neo4j would create new transactions (default read/write)
for the underlying database operations.

In cases where multiple statements are required to execute
a SDN operation this would mean that multiple transaction
would have been created.

This commit fixes this problem and creates new transaction if no
transaction was defined around the invocation of those units-of-work.

The change will introduce a breaking change:
All pure read operations in SDN (like Neo4jTemplate#findAll) will
now happen in read-only transactions.
If they contain custom statements with write operations,
they need to get wrapped in an explicit write transaction.

Closes #2860

Co-authored-by: Michael Simons <michael@simons.ac>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant