[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3104) Using a Constructor in the select clause causes additional selects

Heiko W. Rupp (JIRA) noreply at atlassian.com
Tue Feb 12 09:46:33 EST 2008


Using a Constructor in the select clause causes additional selects
------------------------------------------------------------------

                 Key: HHH-3104
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3104
             Project: Hibernate3
          Issue Type: Bug
         Environment: hibernate 3.2 from rev 14201, Postgres 8.3
            Reporter: Heiko W. Rupp


We have JPA Queries in the form 
"SELECT new Foo(e1, e2.scalar) FROM Entity1 e1 JOIN e1.entity2 e2 WHERE ..."
When I do a Query.getResultList() on this, I end up with 
n+1 Selects for n rows:
- 1 query for the scalar
- n queries for each instance of Entity1 that should be returned.

If I do "SELECT new Foo(e1,e2) .." I even end up with 2 selects per row: 1 for each e1 and one for each e2.

If I do 
"SELECT e1, e2 FROM Entity1 e1 JOIN e1.entity2 e2 WHERE ..." 
I end up with one select only .


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list