[JIRA] (HHH-16806) 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=eyJpIjoiYTczM2VkYjk2... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16806?atlOrigin=eyJpIjoiYTczM2... ) HHH-16806 ( https://hibernate.atlassian.net/browse/HHH-16806?atlOrigin=eyJpIjoiYTczM2... ) the double reference of an entity causes incorrect generation of the LoadQueryDetails object ( https://hibernate.atlassian.net/browse/HHH-16806?atlOrigin=eyJpIjoiYTczM2... )
Issue Type: Bug Affects Versions: 5.3.27 Assignee: Unassigned Attachments: DescriptionLieu.java, ETypeEquipement.java, Equipement.java, Lieu.java, LieuRepository.java, Salle.java Components: hibernate-entitymanager Created: 15/Jun/2023 10:21 AM Environment: jvm 17, windows 10, DB2 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
final LoadPlan 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
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_.codeUserToCreate as codeUser2_0_2_, salle1_.codeUserToUpdate as codeUser3_0_2_, salle1_.dateCreaEnr as dateCrea4_0_2_, salle1_.dateModifEnr as dateModi5_0_2_, salle1_.temoinEnService as temoinEn6_0_2_, salle1_.lieu_id as lieu_id2_3_2_, salle1_. type as type1_3_2_, lieu2_.id as id1_0_3_, lieu2_.codeUserToCreate as codeUser2_0_3_, lieu2_.codeUserToUpdate as codeUser3_0_3_, lieu2_.dateCreaEnr as dateCrea4_0_3_, lieu2_.dateModifEnr as dateModi5_0_3_, lieu2_.temoinEnService as temoinEn6_0_3_ from Equipement equipement0_ inner join Salle salle1_ on equipement0_.SALLEFK=salle1_.id inner join Lieu lieu2_ on salle1_.lieu_id=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 declaration
( https://hibernate.atlassian.net/browse/HHH-16806#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16806#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#100226- sha1:d46780b )
1 year, 3 months