JPA 2.1 Subgraphs of an entity graph generating empty joins

I am using a new feature in JPA 2.1 called Entity Graphics with QueryDSL . It works great. But when I use a subgraph , JPA generates invalid SQL. Here is my example:

@NamedEntityGraph(
     name="defaultGet",
     attributeNodes = {
          @NamedAttributeNode("client"),
          @NamedAttributeNode(value = "tests", subgraph = "testsSG")
     },
     subgraphs ={
          @NamedSubgraph(
               name="testsSG",
               attributeNodes = {
                    @NamedAttributeNode("template")
               }
          )
     }
)

This is where SQL is created:

select
    ...correct stuff....
from
    iq_applicant applicant0_ 
left outer join
    iq_test tests1_ 
        on applicant0_.id=tests1_.applicant 
left outer join
    iq_template template2_ 
        on tests1_.template=template2_.id cross 
join            
                            //WTF?? empty lane??
left outer join
    iq_client client3_ 
        on applicant0_.client=client3_.id 

What is the empty strip doing there? This is mistake?

+3
source share
1 answer

I think this is a hibernation problem. There are several questions: https://hibernate.atlassian.net/browse/HHH-9175 https://hibernate.atlassian.net/browse/HHH-9392

+1
source

All Articles