© Anghel Leonard 2020
A. LeonardSpring Boot Persistence Best Practiceshttps://doi.org/10.1007/978-1-4842-5626-8_6

6. Connections and Transactions

Anghel Leonard1 
(1)
Banesti, Romania
 

Item 60: How to Delay Connection Acquisition Until It’s Really Needed

Starting with Hibernate 5.2.10, the database connection acquisition can be delayed until it’s really needed.

For a hypersonic guide about Spring transaction propagation, check out Appendix G.

In the case of resource-local (a single datasource), Hibernate will acquire the database connection of a JDBC transaction right after the transaction starts (e.g., in Spring, a method annotated with @Transactional acquires the database connection immediately after it is called).

In resource-local, a database connection ...

Get Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.