Rollback/Commit raw connections before close #3579
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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