Bug 1402311 - Same column returned with multiple aliases in scalar query [NEEDINFO]
Summary: Same column returned with multiple aliases in scalar query
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate, JPA
Version: 6.3.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: EAP 6.4.14
Assignee: Gail Badner
QA Contact: Martin Simka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-07 08:49 UTC by Tom Ross
Modified: 2020-04-15 14:57 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-20 14:42:11 UTC
Type: Enhancement
gbadner: needinfo? (tom.ross)


Attachments (Terms of Use)

Description Tom Ross 2016-12-07 08:49:50 UTC
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.

Comment 6 Brad Maxwell 2017-02-20 14:42:11 UTC
Closing as this is an RFE , there is an upstream open for it https://hibernate.atlassian.net/browse/HHH-11313


Note You need to log in before you can comment on or make changes to this bug.