diff --git a/src/main/java/org/dependencytrack/persistence/ProjectQueryManager.java b/src/main/java/org/dependencytrack/persistence/ProjectQueryManager.java index 96440df9a8..fe0037dc30 100644 --- a/src/main/java/org/dependencytrack/persistence/ProjectQueryManager.java +++ b/src/main/java/org/dependencytrack/persistence/ProjectQueryManager.java @@ -31,7 +31,6 @@ import com.github.packageurl.PackageURL; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import org.datanucleus.api.jdo.JDOQuery; import org.dependencytrack.auth.Permissions; import org.dependencytrack.event.IndexEvent; import org.dependencytrack.model.Analysis; @@ -1122,9 +1121,10 @@ private static boolean hasActiveChild(Project project) { } private List getProjectVersions(Project project) { - final Query query = pm.newQuery(JDOQuery.SQL, "SELECT UUID, VERSION FROM PROJECT WHERE NAME = ?"); + final Query query = pm.newQuery(Project.class); + query.setFilter("name == :name"); query.setParameters(project.getName()); - final var stream = query.executeList().stream(); - return stream.map(i -> new ProjectVersion(i[0].toString(), i[1].toString())).toList(); + query.setResult("uuid, version"); + return query.executeList(ProjectVersion.class); } }