[hibernate-issues] [JIRA] (HHH-14084) Lazy property treated as eager when using entity graph

Konrad (JIRA) jira at hibernate.atlassian.net
Wed Jun 24 10:07:08 EDT 2020


Konrad ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A5df3c022-0406-4ac8-9080-6c395fd0db18 ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYWMxNTVhZDM2MDI4NGNkZGJiMDMzZTU0MzVhMmNhMDgiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14084?atlOrigin=eyJpIjoiYWMxNTVhZDM2MDI4NGNkZGJiMDMzZTU0MzVhMmNhMDgiLCJwIjoiaiJ9 ) HHH-14084 ( https://hibernate.atlassian.net/browse/HHH-14084?atlOrigin=eyJpIjoiYWMxNTVhZDM2MDI4NGNkZGJiMDMzZTU0MzVhMmNhMDgiLCJwIjoiaiJ9 ) Lazy property treated as eager when using entity graph ( https://hibernate.atlassian.net/browse/HHH-14084?atlOrigin=eyJpIjoiYWMxNTVhZDM2MDI4NGNkZGJiMDMzZTU0MzVhMmNhMDgiLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.4.14 Assignee: Unassigned Components: hibernate-core Created: 24/Jun/2020 07:07 AM Priority: Major Reporter: Konrad ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A5df3c022-0406-4ac8-9080-6c395fd0db18 )

Two entities have property of same name. In given example Parent and Child entities have properties with name *toys* and only Parent.toys is included in entity graph. After fetching data using entity graph Child.toys are treated as eager fetch.

@NamedEntityGraph(
     name = "parentWithToysAndChild" ,
     attributeNodes = {
           @NamedAttributeNode( "toys" ),
           @NamedAttributeNode( "child" )
     }
)

Hibernate: 
   select
       parent0_.id as id1_3_0_,
       parent0_.child_id as child_id2_3_0_,
       child1_.id as id1_0_1_,
       toys2_.Parent_id as parent_i1_4_2_,
       parenttoy3_.id as toys_id2_4_2_,
       parenttoy3_.id as id1_5_3_,
       parenttoy3_.name as name2_5_3_,
       parenttoy3_.parent_id as parent_i3_5_3_ 
   from
       Parent parent0_ 
   left outer join
       Child child1_ 
           on parent0_.child_id=child1_.id 
   left outer join
       Parent_ParentToy toys2_ 
           on parent0_.id=toys2_.Parent_id 
   left outer join
       ParentToy parenttoy3_ 
           on toys2_.toys_id=parenttoy3_.id 
   where
       parent0_.id=?
Hibernate: 
   select
       toys0_.Child_id as child_id1_1_0_,
       toys0_.toys_id as toys_id2_1_0_,
       childtoy1_.id as id1_2_1_,
       childtoy1_.child_id as child_id3_2_1_,
       childtoy1_.name as name2_2_1_,
       child2_.id as id1_0_2_ 
   from
       Child_ChildToy toys0_ 
   inner join
       ChildToy childtoy1_ 
           on toys0_.toys_id=childtoy1_.id 
   left outer join
       Child child2_ 
           on childtoy1_.child_id=child2_.id 
   where
       toys0_.Child_id=?

Test case repo: https://github.com/MrJavaNoHome/hibernate-orm-entity-graph-redundant-sql

( https://hibernate.atlassian.net/browse/HHH-14084#add-comment?atlOrigin=eyJpIjoiYWMxNTVhZDM2MDI4NGNkZGJiMDMzZTU0MzVhMmNhMDgiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14084#add-comment?atlOrigin=eyJpIjoiYWMxNTVhZDM2MDI4NGNkZGJiMDMzZTU0MzVhMmNhMDgiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100130- sha1:b8a2349 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200624/3c3cb2cf/attachment.html 


More information about the hibernate-issues mailing list