Fixes bug with Colaborator Query

This commit is contained in:
ikalyvas 2019-05-20 14:24:15 +03:00
parent 8a2f6b3c28
commit 37ced95cff
4 changed files with 5 additions and 5 deletions

View File

@ -38,8 +38,8 @@ public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> implements UserInf
@Override
public QueryableList<UserInfo> getAuthenticated(QueryableList<UserInfo> users, UUID principalId) {
users.initSubQuery(UUID.class).where((builder, root) ->
builder.and(builder.equal(root.join("dmps").get("id"),
users.subQuery((builder1, root1) -> builder1.equal(root1.join("dmps").get("id"), principalId),
builder.and(root.join("dmps").get("id").in(
users.subQuery((builder1, root1) -> builder1.equal(root1.get("id"), principalId),
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmps:id")))),
builder.notEqual(root.get("id"), principalId)));

View File

@ -14,7 +14,7 @@ import java.util.*;
@NamedEntityGraphs({
@NamedEntityGraph(
name = "userInfo",
attributeNodes = {@NamedAttributeNode("userRoles"), @NamedAttributeNode("credentials"),@NamedAttributeNode("dmps")}),
attributeNodes = {@NamedAttributeNode("userRoles"), @NamedAttributeNode("credentials")}),
})
public class UserInfo implements DataEntity<UserInfo, UUID> {

View File

@ -55,7 +55,7 @@ public interface QueryableList<T extends DataEntity> {
Subquery<Long> subQueryCount(SinglePredicate<T> predicate, List<SelectionField> fields);
<U extends Comparable> QueryableList<T> initSubQuery(Class<U> uClass);
<U> QueryableList<T> initSubQuery(Class<U> uClass);
<U extends Comparable> Subquery<U> subQueryMax(SinglePredicate<T> predicate, List<SelectionField> fields, Class<U> uClass);

View File

@ -410,7 +410,7 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
return subquery;
}
public <U extends Comparable> QueryableList<T> initSubQuery(Class<U> uClass) {
public <U> QueryableList<T> initSubQuery(Class<U> uClass) {
this.subquery = this.manager.getCriteriaBuilder().createQuery().subquery(uClass);
this.nestedQueryRoot = subquery.from(this.tClass);
return this;