Commit c9217aa6 authored by Matija Obreza's avatar Matija Obreza

Faster loading of image galleries by path

parent 9d5a394b
Pipeline #14170 passed with stage
in 2 minutes
......@@ -116,10 +116,11 @@ public class ImageGalleryServiceImpl implements ImageGalleryService {
normalizedPaths.add(path.normalize().toAbsolutePath().toString());
}
List<RepositoryFolder> folders = jpaQueryFactory.selectFrom(QRepositoryFolder.repositoryFolder).where(QRepositoryFolder.repositoryFolder.path.in(normalizedPaths)).fetch();
List<Long> folders = jpaQueryFactory.select(QRepositoryFolder.repositoryFolder.id).from(QRepositoryFolder.repositoryFolder).where(QRepositoryFolder.repositoryFolder.path.in(normalizedPaths)).fetch();
JPAQuery<ImageGallery> query = jpaQueryFactory.selectFrom(QImageGallery.imageGallery).where(QImageGallery.imageGallery.folder.in(folders));
return query.fetch().stream().map(this::deepLoad).collect(Collectors.toList());
JPAQuery<ImageGallery> query = jpaQueryFactory.selectFrom(QImageGallery.imageGallery).where(QImageGallery.imageGallery.folder.id.in(folders));
return query.fetch()
.stream().map(this::deepLoad).collect(Collectors.toList());
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment