[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3090) Error when executing polymorphic queries with limits

Jaime Porras (JIRA) noreply at atlassian.com
Thu Jan 31 07:40:55 EST 2008


Error when executing polymorphic queries with limits
----------------------------------------------------

                 Key: HHH-3090
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3090
             Project: Hibernate3
          Issue Type: Bug
          Components: core
    Affects Versions: 3.2.5
         Environment: Hibernate 3.2.5, any database
            Reporter: Jaime Porras
         Attachments: HQLQueryPlan.diff, test-polymorphic.tar.gz

When a polymorphic search is performed HQLQueryPlan.performList() never return any results because there is a mistake in this code:

for ( int x = 0; x < size; x++ ) {
    final Object result = tmp.get( x );
    if ( distinction.add( result ) ) {
        continue;
    }
    includedCount++;
    if ( includedCount < first ) {
        continue;
    }
    combinedResults.add( result );
    if ( max >= 0 && includedCount > max ) {
        // break the outer loop !!!
        break translator_loop;
    }
}

The call to distinction.add( result ) returns true when the result is added and false when the result is already in the set. So the if code should be:

    if ( !distinction.add( result ) ) {
        continue;
    }


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