| For perspective, this is something we discussed back as far as 10 years ago... specifically about delaying the acquisition of the Connection beyond what we do even still today to cater to micro-benchmarks. We decided that catering to micro-benchmarks was silly as it does not match real-world scenarios. But why would any of this matter? Your claim is that the application begins a transaction (a transactional method is the same thing) but does not want to acquire a Connection. I'll assert that this effects an extremely small population and I'll even go further to question the validity of this use case. The application chooses to start a transaction. Why can't it simply chose to not start the transaction? At the same time, if this is something everyone agrees we should do and you feel strongly enough about it and want to put in the effort of adding yet another config knob and document such a thing, then I'd add a few caveats:
- this new setting should default to whatever hibernate.connection.autocommit is set to
- IMO this really entails a whole new "Connection management" scheme where an auto-commit Connection is auto-released under the same circumstances as what we do under JTA transactions. That would be the logical continuation of your thought... which specific Connection is used is actually completely irrelevant and we could aggressively release the Connections back to the provider.
|