Skip to content

Clarify transaction boundary recommendation #3842

Closed
@seungcheol-kwon

Description

@seungcheol-kwon

Hi Spring Data JPA team,

While reading the official documentation on transaction management
(https://github.com/spring-projects/spring-data-jpa/blob/3.4.4/src/main/antora/modules/ROOT/pages/jpa/transactions.adoc),
I noticed that it might give the impression that @Transactional should be placed on the repository layer to define transaction boundaries.

However, in most real-world applications, transaction boundaries are typically defined at the service layer.
This is because the service layer represents the unit of business logic that should execute atomically,
and transaction control is better handled in the service layer for consistency and clarity.

So I’d like to clarify the actual intent of the documentation:
Is it encouraging developers to define @Transactional on the repository layer, or was that example simply meant to demonstrate how to provide default read-only settings?

Currently, it can be misinterpreted as a recommendation to control transactions at the repository level.
If that’s not the intended message, I believe it would be helpful to revise or clarify the documentation to prevent confusion.

Thanks for your great work on the project, and I look forward to your guidance!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions