Issue Details (XML | Word | Printable)

Key: HHH-3090
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Jaime Porras
Votes: 5
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Hibernate Core

Error when executing polymorphic queries with limits

Created: 31/Jan/08 06:39 AM   Updated: 27/Jul/08 02:27 PM
Return to search
Component/s: core
Affects Version/s: 3.2.5
Fix Version/s: None

Time Tracking:
Original Estimate: 10 minutes
Original Estimate - 10 minutes
Remaining Estimate: 10 minutes
Remaining Estimate - 10 minutes
Time Spent: Not Specified
Time Spent - Not Specified

File Attachments: 1. File HQLQueryPlan.diff (0.1 kB)
2. GZip Archive test-polymorphic.tar.gz (2 kB)

Environment: Hibernate 3.2.5, any database

Bug Testcase Reminder (view):
REMINDER: Bug reports should generally be accompanied by a test case
Participants: Carl Crowder and Jaime Porras


 Description  « Hide

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



Carl Crowder added a comment - 27/Jul/08 02:27 PM

For what it's worth, this was present in 3.2.2.ga too, as I've just discovered.