Rollback/Commit raw connections before close by rPraml · Pull Request #3579 · ebean-orm/ebean
Summary of changes:
- Add commit() obtaining Sequence values
- Add rollback() when detecting database platform via jdbc meta data
- Add rollback() when detecting AutoCommit mode
- Add rollback() when obtaining query plan
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