Search in sources :

Example 1 with LoadGroup

use of org.eclipse.persistence.queries.LoadGroup in project cuba by cuba-platform.

the class FetchGroupManager method addView.

public void addView(JpaQuery query, String queryString, View view, boolean singleResultExpected) {
    Preconditions.checkNotNullArgument(query, "query is null");
    Preconditions.checkNotNullArgument(view, "view is null");
    Map<String, Object> hints = query.getHints();
    AttributeGroup ag = null;
    if (view.loadPartialEntities()) {
        if (hints != null)
            ag = (FetchGroup) hints.get(QueryHints.FETCH_GROUP);
        if (ag == null)
            ag = new FetchGroup();
    } else {
        if (hints != null)
            ag = (LoadGroup) hints.get(QueryHints.LOAD_GROUP);
        if (ag == null)
            ag = new LoadGroup();
    }
    applyView(query, queryString, ag, view, singleResultExpected);
}
Also used : AttributeGroup(org.eclipse.persistence.queries.AttributeGroup) FetchGroup(org.eclipse.persistence.queries.FetchGroup) LoadGroup(org.eclipse.persistence.queries.LoadGroup)

Example 2 with LoadGroup

use of org.eclipse.persistence.queries.LoadGroup in project cuba by cuba-platform.

the class FetchGroupManager method setView.

public void setView(JpaQuery query, String queryString, @Nullable View view, boolean singleResultExpected) {
    Preconditions.checkNotNullArgument(query, "query is null");
    if (view != null) {
        AttributeGroup ag = view.loadPartialEntities() ? new FetchGroup() : new LoadGroup();
        applyView(query, queryString, ag, view, singleResultExpected);
    } else {
        query.setHint(QueryHints.FETCH_GROUP, null);
    }
}
Also used : AttributeGroup(org.eclipse.persistence.queries.AttributeGroup) FetchGroup(org.eclipse.persistence.queries.FetchGroup) LoadGroup(org.eclipse.persistence.queries.LoadGroup)

Aggregations

AttributeGroup (org.eclipse.persistence.queries.AttributeGroup)2 FetchGroup (org.eclipse.persistence.queries.FetchGroup)2 LoadGroup (org.eclipse.persistence.queries.LoadGroup)2