HHH-1283 : Join fetched collections using Query.scroll() is correct only for first entity

(cherry picked from commit 3a72b45325)
This commit is contained in:
Gail Badner 2012-09-13 12:30:15 -07:00
parent 608f6a2a11
commit 1871e9336e
1 changed files with 12 additions and 1 deletions

View File

@ -395,7 +395,7 @@ public abstract class Loader {
}
}
while ( resultSet.next() &&
keyToRead.equals( getKeyFromResultSet( 0, getEntityPersisters()[0], null, resultSet, session ) ) );
isCurrentRowForSameEntity( keyToRead, 0, resultSet, session ) );
}
catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert(
@ -415,6 +415,17 @@ public abstract class Loader {
return result;
}
private boolean isCurrentRowForSameEntity(
final EntityKey keyToRead,
final int persisterIndex,
final ResultSet resultSet,
final SessionImplementor session) throws SQLException {
EntityKey currentRowKey = getKeyFromResultSet(
persisterIndex, getEntityPersisters()[persisterIndex], null, resultSet, session
);
return keyToRead.equals( currentRowKey );
}
/**
* Loads a single logical row from the result set moving forward. This is the
* processing used from the ScrollableResults where there were collection fetches