Make entity graph traversal approach (width-first or depth-first) configurable in Hibernate 6 #6284
Replies: 2 comments 1 reply
-
We've discussed some options for this in 2 broad cases
I don't think we'll go all the way to allowing depth first transversal. If you really feel you want the option to allow depth-first specifically, feel free to continue the discussion here - but be prepared to take on implementing that work yourself. |
Beta Was this translation helpful? Give feedback.
-
The problem you are describing has nothing to do with how we traverse the model, but rather with how we determine circularity. In 5, we just collected every The behavior is nicely described in the migration guide for EAGER fetching, but also applies for Personally, I don't see a problem with what we do now in 6. It's your model that needs to be revisited. We were thinking about a |
Beta Was this translation helpful? Give feedback.
-
Hibernate 6 chose to use the width-first graph-traversal for fetch determination. That causes much more joins than Hibernate 5 with depth-first traversal had. As a result, classes with many lazy relations(3+) are performing poor. In some cases the SQL queries are failing because of "Too many tables" error.
In large projects, is not trivial to get rid of lazy relations.
Could be possible to make graph traversal configurable in Hibernate 6, so depth-first can be used when needed?
Beta Was this translation helpful? Give feedback.
All reactions