Skip to content

Files

Latest commit

 

History

History

HibernateSpringBootRedundantSave

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Avoid Spring Redundant save() Call

Description: This application is an example when calling save() for an entity is redundant (not necessary).

Key points:

  • at flush time, Hibernate relies on dirty checking mechanism to determine the potential modifications in entities
  • for each modification, Hibernate automatically triggers the corresponding UPDATE statement without the need to explicitly call the save() method
  • behind the scene, this redundancy (calling save() when is not necessarily) doesn't affect the number of triggered queries, but it implies a performance penalty in the underlying Hibernate processes

If you need a deep dive into the performance recipes exposed in this repository then I am sure that you will love my book "Spring Boot Persistence Best Practices"If you need a hand of tips and illustrations of 100+ Java persistence performance issues then "Java Persistence Performance Illustrated Guide" is for you.