Skip to content

Conversation

@rPraml
Copy link
Contributor

@rPraml rPraml commented Feb 27, 2025

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

@rbygrave rbygrave added this to the 14.10.0 milestone Mar 3, 2025
@rbygrave rbygrave merged commit b4ff574 into ebean-orm:master Mar 3, 2025
1 check passed
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.

2 participants