[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4794) "is empty" with inner join generates invalid sql select and invalid results

Ramon Casha (JIRA) noreply at atlassian.com
Thu Jan 14 04:09:32 EST 2010


"is empty" with inner join generates invalid sql select and invalid results
---------------------------------------------------------------------------

                 Key: HHH-4794
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4794
             Project: Hibernate Core
          Issue Type: Bug
          Components: query-hql
    Affects Versions: 3.3.2
         Environment: Hibernate version as provided with Netbeans 6.8 (Hibernate EntityManager 3.3.2.GA, Hibernate Annotations 3.3.1.GA)

DBMS: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production; With the OLAP and Data Mining options
            Reporter: Ramon Casha
         Attachments: testcase.zip

Given two simple entities, Master and Detail which have a OneToMany relationship:

The following JPQL query...

Select T from Master T, in(T.details) D where D is empty

generates the following SQL:

[1]  select master0_.id as id0_ 
[2]  from Master master0_ 
[3]  inner join Detail details1_ on master0_.id=details1_.master_id 
[4]  where  not (exists (select details1_.id from Detail details1_));


Line 4 is incorrect! The alias created there (details1_) is DIFFERENT from details1_ on line 3, so the subquery runs over the entire table, not the inner-joined table in line 3.

Testcase included

-- 
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