HHH-14650 AbstractRowReader: remove more redundant checks

This commit is contained in:
Sanne Grinovero 2021-06-03 10:14:35 +01:00
parent 84e7c5f63b
commit 5579a38d4d
1 changed files with 16 additions and 26 deletions

View File

@ -63,39 +63,29 @@ public abstract class AbstractRowReader implements RowReader {
@Override @Override
public Object readRow(ResultSet resultSet, ResultSetProcessingContextImpl context) throws SQLException { public Object readRow(ResultSet resultSet, ResultSetProcessingContextImpl context) throws SQLException {
// 1) allow entity references to resolve identifiers (in 2 steps)
final boolean hasEntityReferenceInitializers = entityReferenceInitializers.length != 0; for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) {
entityReferenceInitializer.hydrateIdentifier( resultSet, context );
if ( hasEntityReferenceInitializers ) { }
// 1) allow entity references to resolve identifiers (in 2 steps) for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) {
for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { resolveEntityKey(
entityReferenceInitializer.hydrateIdentifier( resultSet, context ); resultSet,
} context,
for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { entityReferenceInitializer
resolveEntityKey( );
resultSet,
context,
entityReferenceInitializer
);
}
// 2) allow entity references to resolve their non-identifier hydrated state and entity instance
for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) {
entityReferenceInitializer.hydrateEntityState( resultSet, context );
}
} }
// 2) allow entity references to resolve their non-identifier hydrated state and entity instance
for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) {
entityReferenceInitializer.hydrateEntityState( resultSet, context );
}
// 3) read the logical row // 3) read the logical row
Object logicalRow = readLogicalRow( resultSet, context ); Object logicalRow = readLogicalRow( resultSet, context );
// 4) allow arrays, entities and collections after row callbacks // 4) allow arrays, entities and collections after row callbacks
if ( hasEntityReferenceInitializers ) { for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) {
for ( EntityReferenceInitializer entityReferenceInitializer : entityReferenceInitializers ) { entityReferenceInitializer.finishUpRow( resultSet, context );
entityReferenceInitializer.finishUpRow( resultSet, context );
}
} }
for ( CollectionReferenceInitializer collectionReferenceInitializer : collectionReferenceInitializers ) { for ( CollectionReferenceInitializer collectionReferenceInitializer : collectionReferenceInitializers ) {
collectionReferenceInitializer.finishUpRow( resultSet, context ); collectionReferenceInitializer.finishUpRow( resultSet, context );