Hibernate 6 - OOM ISSUE

:bug: Dear Hibernate Team, we need to talk.

We upgraded from Spring Boot 2.7 β†’ 3.3.10.

Everything looked fine. Until production crashed. :collision:

The culprit?

java

repository.save(entity); // one innocent line

In Hibernate 5 β†’ shallow merge β†’ works fine :white_check_mark:

In Hibernate 6 β†’ loads your ENTIRE database into heap :collision:

Our table had 10 million rows. Scheduler calling save() every 15 seconds. Heap filled up silently. Entire JVM died taking down Kafka, SQS and Tomcat with it.

The worst part?

:white_check_mark: Works perfectly on fresh database :cross_mark: Only crashes on production data

Impossible to catch in testing. :cry:


Dear @Hibernate team β€” can we get:**

  1. A clear warning in docs that save() behavior fundamentally changed in Hibernate 6

  2. A migration guide specifically for large dataset scenarios

  3. A configuration option to control merge cascade depth

This is silently breaking production systems everywhere after Spring Boot 3.x upgrades.

Has your team hit this? :backhand_index_pointing_down:

cc: @Hibernate @SpringBoot

#Java #Hibernate #SpringBoot3 #OutOfMemoryError #JPA #JavaDeveloper #OpenSource

There are clear migration guides for every Hibernate ORM version. You’re likely affected by the fetch circularity detection change, but that is more than likely a problem of your data model, because you probably cascade too many associations.

There is nothing we can do to prevent this from happening, because it’s entirely on you to test your app properly before rolling out updates and reading the migration guides.