Spring Boot · Medium
Difference between save() and saveAndFlush().
Spring BootJPA & TransactionsRepositoriesSeniorStaff
Answer preview
save() — persists or merges the entity in the JPA persistence context (first-level cache). The actual SQL INSERT/UPDATE may be deferred until the transaction commits or the persistence context is flushed. Hibernate batches SQL operations for efficiency.…