Hibernate HQL join fetch not recursively fetching

后端 未结 7 529
挽巷
挽巷 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:32

    If you know that you have only two levels in your tree, have you thought of joining deeper one level. Something like below?

    SELECT DISTINCT domain FROM Domain domain 
      LEFT OUTER JOIN FETCH domain.operators operators1 
      LEFT OUTER JOIN FETCH domain.networkCodes 
      LEFT OUTER JOIN FETCH operators1.operators operators2 
      LEFT OUTER JOIN FETCH operators1.networkCodes
    WHERE domain.domainId = :domainId
    

提交回复
热议问题