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;
}
For what it's worth, this was present in 3.2.2.ga too, as I've just discovered.