Hide Forgot
In the case of a relation "OneToMany" between two JPA entities, when we make a search on the parent entity, the generated SQL presents duplicated fields. Hele is an example : select school0_.ID as ID1_0_0_, students1_.ID as ID1_1_1_, school0_.NAME as NAME2_0_0_, school0_.ZIP_CODE as ZIP_CODE3_0_0_, students1_.FNAME as FNAME2_1_1_, students1_.LNAME as LNAME3_1_1_, students1_.SCHOOL_ID as SCHOOL_I4_0_0__, students1_.ID as ID1_1_0__ from SCHOOL school0_ inner join STUDENT students1_ on school0_.ID=students1_.SCHOOL_ID where school0_.ZIP_CODE=? order by school0_.ID in more complicated cases, there can be more than two duplicated fields. Although the duplication of fields doesn't distort perfromance at a DB level, this problem is critical for us regarding network performances. We are indeed making hundred millions of queries a year.
I just wanted to mention a comment I made on the upstream jira: https://hibernate.atlassian.net/browse/HHH-11313?focusedCommentId=87510&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-87510
Closing as this is an RFE , there is an upstream open for it https://hibernate.atlassian.net/browse/HHH-11313