Hibernate HQL join fetch not recursively fetching

后端 未结 7 528
挽巷
挽巷 2020-12-30 05:07

I have the following query and method

private static final String FIND = \"SELECT DISTINCT domain FROM Domain domain LEFT OUTER JOIN FETCH domain.operators L         


        
相关标签:
7条回答
  • 2020-12-30 05:42

    Your EAGER mapping will only be considered automatically by Hibernate if you use the Criteria API for the query.

    If you use HQL, you will need to manually add the FETCH keyword to your JOINs to force Hibernate to include the relations in the first query and avoid subsequent queries.

    This is Hibernate-specific and may work differently on other ORMs.

    See this question/answer for a slightly different angle.

    0 讨论(0)
提交回复
热议问题