3

我在 JPA 2.1 中使用了一个名为Entity Graphs with QueryDSL的新功能。它工作得很好。但是当我使用subgraph时,JPA 会生成无效的 SQL。这是我的示例:

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

这是生成的SQL:

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 

那条空荡荡的车道在里面做什么?这是一个错误吗?

4

1 回答 1

1

我猜这是休眠问题。有几个问题: https://hibernate.atlassian.net/browse/HHH-9175 https://hibernate.atlassian.net/browse/HHH-9392

于 2014-11-25T12:39:59.923 回答