[JIRA] (HHH-16807) the double reference of an entity causes incorrect generation of the LoadQueryDetails object
by arnaud barbe (JIRA)
arnaud barbe ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5d5d8e5... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYzliYmRhYTcz... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16807?atlOrigin=eyJpIjoiYzliYm... ) HHH-16807 ( https://hibernate.atlassian.net/browse/HHH-16807?atlOrigin=eyJpIjoiYzliYm... ) the double reference of an entity causes incorrect generation of the LoadQueryDetails object ( https://hibernate.atlassian.net/browse/HHH-16807?atlOrigin=eyJpIjoiYzliYm... )
Change By: arnaud barbe ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5d5d8e5... )
Hi everyOne
During hibernate/JPA init sequence in +AbstractLoadPlanBasedCollectionInitializer+ class line 61 and 62 these instruction was executed
{code:java}finalLoadPlan plan =MetamodelDrivenLoadPlanBuilder.buildRootCollectionLoadPlan( strategy, collectionPersister );
this.staticLoadQuery =BatchingLoadQueryDetailsFactory.INSTANCE.makeCollectionLoadQueryDetails( collectionPersister, plan, buildingParameters );{code}
When building collectionPersister OneToManyPersister for Lieu.equipements collection
this.staticLoadQuery should contain a query to load equipment from Lieu like this one
{code:sql}select equipement0_.sallefk as sallefk4_1_0_, equipement0_.id as id1_1_0_, equipement0_.id as id1_1_1_, equipement0_.lieufk as lieufk3_1_1_, equipement0_.sallefk as sallefk4_1_1_, equipement0_.type as type2_1_1_, lieu1_.id as id1_2_2_, lieu1_.description as descript2_2_2_, lieu1_.published as publishe3_2_2_, lieu1_.title as title4_2_2_ from equipement equipement0_ inner join lieu lieu1_ on equipement0_.lieufk=lieu1_.id where equipement0_.lieufk=?{code}
But a query passing by table lieu → salle → equipement like this one is generated
{code:sql}select equipement0_.lieufk as lieufk3_1_0_, equipement0_.id as id1_1_0_, equipement0_.id as id1_1_1_, equipement0_.lieufk as lieufk3_1_1_, equipement0_.sallefk as sallefk4_1_1_, equipement0_.type as type2_1_1_, salle1_.id as id1_0_2_, salle1_.code_user_to_create as code_use2_0_2_, salle1_.code_user_to_update as code_use3_0_2_, salle1_.date_crea_enr as date_cre4_0_2_, salle1_.date_modif_enr as date_mod5_0_2_, salle1_.temoin_en_service as temoin_e6_0_2_, salle1_.lieufk as lieufk2_3_2_, salle1_.type as type1_3_2_, lieu2_.id as id1_2_3_, lieu2_.description as descript2_2_3_, lieu2_.published as publishe3_2_3_, lieu2_.title as title4_2_3_ from equipement equipement0_ inner join salle salle1_ on equipement0_.sallefk=salle1_.id inner join lieu lieu2_ on salle1_.lieufk=lieu2_.id where equipement0_.lieufk=?{code}
the declaration of my model seems good
I have the impression that the loadPlan doesn't seem to match the joint declarati declaration
To reproduce the case, use maven project in attachement, put breakpoint in +AbstractLoadPlanBasedCollectionInitializer+ class line 61 and run in debug the test class SpringBootJpaH2ApplicationTests.
( https://hibernate.atlassian.net/browse/HHH-16807#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16807#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:5147d46 )
1 year, 3 months
[JIRA] (HHH-16807) the double reference of an entity causes incorrect generation of the LoadQueryDetails object
by arnaud barbe (JIRA)
arnaud barbe ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5d5d8e5... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOWI0NzA5YjBm... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16807?atlOrigin=eyJpIjoiOWI0Nz... ) HHH-16807 ( https://hibernate.atlassian.net/browse/HHH-16807?atlOrigin=eyJpIjoiOWI0Nz... ) the double reference of an entity causes incorrect generation of the LoadQueryDetails object ( https://hibernate.atlassian.net/browse/HHH-16807?atlOrigin=eyJpIjoiOWI0Nz... )
Issue Type: Bug Affects Versions: 5.6.15 Assignee: Unassigned Attachments: database-crud.zip Components: hibernate-entitymanager Created: 16/Jun/2023 01:43 AM Environment: jvm 17, windows 10, H2 Priority: Major Reporter: arnaud barbe ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5d5d8e5... )
Hi everyOne
During hibernate/JPA init sequence in AbstractLoadPlanBasedCollectionInitializer class line 61 and 62 these instruction was executed
finalLoadPlan plan =MetamodelDrivenLoadPlanBuilder.buildRootCollectionLoadPlan( strategy, collectionPersister );
this.staticLoadQuery =BatchingLoadQueryDetailsFactory.INSTANCE.makeCollectionLoadQueryDetails( collectionPersister, plan, buildingParameters );
When building collectionPersister OneToManyPersister for Lieu.equipements collection
this.staticLoadQuery should contain a query to load equipment from Lieu like this one
select equipement0_.sallefk as sallefk4_1_0_, equipement0_.id as id1_1_0_, equipement0_.id as id1_1_1_, equipement0_.lieufk as lieufk3_1_1_, equipement0_.sallefk as sallefk4_1_1_, equipement0_. type as type2_1_1_, lieu1_.id as id1_2_2_, lieu1_.description as descript2_2_2_, lieu1_.published as publishe3_2_2_, lieu1_.title as title4_2_2_ from equipement equipement0_ inner join lieu lieu1_ on equipement0_.lieufk=lieu1_.id where equipement0_.lieufk=?
But a query passing by table lieu → salle → equipement like this one is generated
select equipement0_.lieufk as lieufk3_1_0_, equipement0_.id as id1_1_0_, equipement0_.id as id1_1_1_, equipement0_.lieufk as lieufk3_1_1_, equipement0_.sallefk as sallefk4_1_1_, equipement0_. type as type2_1_1_, salle1_.id as id1_0_2_, salle1_.code_user_to_create as code_use2_0_2_, salle1_.code_user_to_update as code_use3_0_2_, salle1_.date_crea_enr as date_cre4_0_2_, salle1_.date_modif_enr as date_mod5_0_2_, salle1_.temoin_en_service as temoin_e6_0_2_, salle1_.lieufk as lieufk2_3_2_, salle1_. type as type1_3_2_, lieu2_.id as id1_2_3_, lieu2_.description as descript2_2_3_, lieu2_.published as publishe3_2_3_, lieu2_.title as title4_2_3_ from equipement equipement0_ inner join salle salle1_ on equipement0_.sallefk=salle1_.id inner join lieu lieu2_ on salle1_.lieufk=lieu2_.id where equipement0_.lieufk=?
the declaration of my model seems good
I have the impression that the loadPlan doesn't seem to match the joint declarati
( https://hibernate.atlassian.net/browse/HHH-16807#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16807#add-comment?atlOrigin=ey... )
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.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:5147d46 )
1 year, 3 months