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

Potential Logging Issue with Interaction Between Spring Boot @Transactional and R2DBC H2's readOnly Property #247

Open
guqing opened this issue Jan 24, 2024 · 0 comments

Comments

@guqing
Copy link

guqing commented Jan 24, 2024

Hello R2DBC H2 Team,

I hope this message finds you well. I'm reaching out to discuss a potential issue I've encountered while integrating R2DBC H2 with Spring Boot.

Description:

In a project using Spring Boot and R2DBC H2, I've observed that whenever a method in the repository layer is annotated with @Transactional, R2DBC H2 consistently logs a message about the connection's read-only status.

This behavior was noted during my usage of these technologies, and after a thorough search through existing issues and discussions on GitHub, as well as a comprehensive review of relevant topics on Stack Overflow, I couldn't find any mention or solution to this specific scenario.

The issue seems to be related to how the readOnly property is handled in R2DBC H2, specifically in H2Connection.java (refer to code: H2Connection.java Line 96.

Issue:

In R2DBC H2, readOnly is a Boolean type, allowing for null, true, or false values. However, in Spring Boot's @Transactional annotation, readOnly is a primitive boolean type with a default value of false. This results in R2DBC H2 logging a read-only state message even when the readOnly attribute in the @Transactional annotation is not explicitly set (thus, defaulting to false). This could lead to some confusion, as developers might mistakenly think that some transactions are incorrectly set to read-only.

Questions:

  • Is it intentional for R2DBC H2 to handle the readOnly attribute in this manner?
  • Is this logging behavior as expected?
  • Is there a possibility to adjust R2DBC H2 to better accommodate the interaction with Spring Boot's @Transactional annotation?

Additional Information:

  • Spring Boot version: 3.2.0
  • R2DBC H2 version: 1.0.0-RELEASE

I appreciate any guidance or information you can provide on this matter. Thank you for your time and dedication to maintaining this project.

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