private static void resolveIdentifierFetch(
ResultSet resultSet,
ResultSetProcessingContext context,
Fetch fetch) throws SQLException {
if ( fetch instanceof EntityFetch ) {
EntityFetch entityFetch = (EntityFetch) fetch;
final IdentifierResolutionContext identifierResolutionContext =
context.getIdentifierResolutionContext( entityFetch );
if ( identifierResolutionContext.getEntityKey() != null ) {
return;
}
EntityKey fetchKey = entityFetch.resolveInIdentifier( resultSet, context );
identifierResolutionContext.registerEntityKey( fetchKey );
}
else if ( fetch instanceof CompositeFetch ) {
for ( Fetch subFetch : ( (CompositeFetch) fetch ).getFetches() ) {
resolveIdentifierFetch( resultSet, context, subFetch );