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

Rollback/Commit raw connections before close #3579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rPraml
Copy link
Contributor

@rPraml rPraml commented Feb 27, 2025

This PR makse ebean ready to follow the JDBC spec for close.
See ebean-orm/ebean-datasource#107 for details.
Here we introduce closeWithinTxn=fail so that the ebean datasource enforces commit/rollback as some drivers will do. We see missing rollbacks in tests.

Note: by default the ebean-datasource should and would handle this situation automatically in production, if there was a missing commit/rollback
(Other datasources like hikariCP put a lot of effort to find out, if there is an open txn: brettwooldridge/HikariCP@2238981 and do similar things- i'm unsure, if it is worth, as there are only a few places, where commit/rollback is missing)

Q: You may ask, why do we need the commits and rollbacks now and not rely on ebean-datasource directly to handle this situation
A1: It is strongly recommended by the JDBC spec.
A2: You may use a different datasource or even the DB2-driver without a DS at all (not recommended), then you will need the commits

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

Successfully merging this pull request may close these issues.

1 participant