diff --git a/dmp-backend/core/src/main/java/eu/eudat/query/TenantUserQuery.java b/dmp-backend/core/src/main/java/eu/eudat/query/TenantUserQuery.java index 44a52e600..a0884b075 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/query/TenantUserQuery.java +++ b/dmp-backend/core/src/main/java/eu/eudat/query/TenantUserQuery.java @@ -14,7 +14,6 @@ import gr.cite.tools.data.query.QueryBase; import gr.cite.tools.data.query.QueryContext; import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.Predicate; -import jakarta.persistence.criteria.Subquery; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -168,9 +167,8 @@ public class TenantUserQuery extends QueryBase { predicates.add(inClause); } if (this.userQuery != null) { - Subquery subQuery = queryContext.Query.subquery(this.userQuery.entityClass()); - this.applySubQuery(this.userQuery, queryContext.CriteriaBuilder, subQuery); - predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(TenantUserEntity._userId)).value(subQuery)); + QueryContext subQuery = this.applySubQuery(this.userQuery, queryContext, UUID.class, root -> root.get(TenantUserEntity._userId)); + predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(TenantUserEntity._userId)).value(subQuery.Query)); } if (predicates.size() > 0) { Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);