Recursive join fetch #6100
Replies: 1 comment 2 replies
-
Is this for the famous problem of fetching trees? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We added the recursive CTE construct to model the canonical way to do recursive queries in HQL, but I think it would be nice to extend this a bit. Here are a few ideas.
The idea is that we introduce a new kind of join, a recursive join, which we translate to a recursive CTE. Recursive joins would only be allowed on self referencing
@ManyToOne
/@OneToMany(mappedBy)
associations.If we want to support EAGER fetching of recursive associations we would probably need some sort of
@RecursiveParent
/@RecursiveChildren
annotation to mark associations in an entity model, so that we can generate the proper query, but I guess we can ignore that for now.The really interesting part is when join fetching collections e.g.
from Entity1 a recursive join fetch a.children
, as that has an implication on theFetch
we generate and how we process results, since all nested collection will become initialized this way.See https://hibernate.atlassian.net/browse/HHH-16187
Beta Was this translation helpful? Give feedback.
All reactions