-
Notifications
You must be signed in to change notification settings - Fork 38.5k
HibernateTransactionManager should lazily acquire JDBC Connection (like HibernateJpaDialect) [SPR-17216] #21749
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
Comments
Juergen Hoeller commented Our recommended solution for such a scenario is to declare your Otherwise, turning off connection preparation and In any case, this should be properly covered in the reference documentation, so I'm turning this into a documentation task. |
mishraawake commented Thank you for recommendation. It is exactly what we were looking for. In fact, this is so enticing that it should be the primary recommendation for the datasource in spring. That makes me to ask following question, is there any drawback/hidden problem in using this datasource?
|
Juergen Hoeller commented No real drawback as far as I am aware. It's an extra dynamic proxy instance for each decorating connection which involves a little bit of overhead, and the That said, I'm considering to make |
Juergen Hoeller commented As of 5.1 RC3, we're lazily retrieving JDBC Connections via an on-demand |
mishraawake opened SPR-17216 and commented
We are trying to implement the feature “provider_disables_autocommit” in our application.
Problem context in our application: We have a manager class which has complex business logic. We configured HibernateTransactionManager around the methods of manager class.
In many cases, we simply returns from the manager without touching the database.
This option of hibernate seems very promising to us. However, we observe there are some caveat with the option.
. To implement this is via spring HibernateTransactionManager, we have to set txManager.setPrepareConnection(false), txManager.setAutodetectDataSource(false) , otherwise it tries to acquire connection when transaction is starting. Is there a negative impact of this?
Affects: 5.0.8
Issue Links:
Referenced from: commits 78cad0f
The text was updated successfully, but these errors were encountered: