-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Configuration property to make transaction mandatory even for read operations #34016
Comments
+1 to a setting to disable the request-scoped entity manager in Hibernate ORM (as opposed to the transaction-scoped ones). See here for the relevant runtime code: Lines 102 to 105 in 2c0cfbd
Personally, I'd even consider disabling the request-scoped entity manager by default in the next major version of Quarkus. There are very few, if any, reasons for using Hibernate ORM without transactions, and IMO that should be opt-in for people who really need it. |
@yrodiere I am with you about the opt in👍 |
@yrodiere This seems not have any traction, therefor it might be closed. What is your opinion? |
Thanks for the reminder. This seems worth doing and not terribly complicated to implement; the Quarkus team just didn't get to doing it because of other priorities. I'll mark as good first issue, so if you or someone else have spare time, they can give it a try :) |
I’m interested in working on this issue. Could you provide more details on what’s needed? |
Great, thanks for considering a contribution! See the issue description, and feel free to ask question if something is not clear. I also commented with some hints as to where the check could be implemented:
|
Description
I recently discovered that I can perform read operations using a Panache repository during a QuarkusTest without an active transaction. This behavior took me by surprise, and it also resulted in incorrect data being returned (possibly due to caching. Unfortunately, I couldn't reproduce the issue with a reproducer). As soon as I put an active transaction around the test, everything works as expected. I attempted to find a configuration option to enforce a transaction for read operations, but I was unable to locate a suitable setting.
It seems that setting the TransactionRequirement to STRICT is not a viable solution for me, as it would prevent the Liquibase migration from executing.
Without putting into question that no transaction is required to read, I would like to propose a new configuration property to be able to enforce transactions even for read operation. This way, everyone can use transactions according to their preferences.
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: