Hibernate Articles
4 articles about Hibernate. Explore Spring Boot implementation, design, and operations across related topics.
-
How to Speed Up Bulk INSERTs with Spring Data JPA - hibernate.jdbc.batch_size and Batching saveAll
Explains why calling saveAll() still results in INSERTs being executed one at a time, covering the mechanics of hibernate.jdbc.batch_size, order_inserts, and IDENTITY generation. From PostgreSQL's reWriteBatchedInserts to a comparison with JdbcTemplate.batchUpdate, it walks through the steps to speed up bulk INSERTs while verifying with SQL logs.
-
How to Fix LazyInitializationException in Spring Boot + JPA - Causes and Solutions for "could not initialize proxy - no Session"
Solve the LazyInitializationException (could not initialize proxy - no Session) that crashes the moment you access a lazily-loaded association in Spring Data JPA, working backwards from how Hibernate sessions and transaction boundaries operate. Compares the four proper approaches—JOIN FETCH, @EntityGraph, DTO projection, and @Transactional—and provides criteria for making decisions without resorting to open-in-view=true or switching to EAGER.
-
How to Implement Multi-Tenancy in Spring Boot
A guide to implementing multi-tenancy (Database/Schema/Shared-schema) with Spring Boot 3.2 and Hibernate 6.4, explained with comparison tables and working code. Covers everything from MultiTenantConnectionProvider to tenant resolution Filters using JWT/headers.
-
How to Implement Soft Delete with Spring Boot + JPA - Choosing Between @SQLDelete, @SQLRestriction, and Filters
Learn how to implement soft delete transparently with Spring Boot 3.x + Hibernate 6.4. We compare @SQLDelete + @SQLRestriction (formerly @Where) with @SoftDelete and @FilterDef so you can choose the right approach quickly, and cover common pitfalls such as unique constraint conflicts, restore operations, and recording who performed the deletion.