The code in BackendCustomLoader.getLoader(SessionImplementor, Class<?>) assumes we always deal with an OgmLoader but it will be a DynamicBatchingEntityLoader if @BatchSize has been given for that entity.