mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
use less joins
This commit is contained in:
@@ -16,6 +16,7 @@ import javax.persistence.criteria.Path;
|
|||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
import javax.persistence.criteria.Selection;
|
import javax.persistence.criteria.Selection;
|
||||||
|
import javax.persistence.criteria.SetJoin;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -318,14 +319,12 @@ public class FeedEntryStatusDAO extends GenericDAO<FeedEntryStatus> {
|
|||||||
CriteriaQuery<FeedEntry> query = builder.createQuery(FeedEntry.class);
|
CriteriaQuery<FeedEntry> query = builder.createQuery(FeedEntry.class);
|
||||||
Root<FeedEntry> root = query.from(FeedEntry.class);
|
Root<FeedEntry> root = query.from(FeedEntry.class);
|
||||||
|
|
||||||
Join<FeedFeedEntry, Feed> feedJoin = root.join(FeedEntry_.feedRelationships).join(FeedFeedEntry_.feed);
|
Join<FeedEntry, FeedFeedEntry> ffeJoin = root.join(FeedEntry_.feedRelationships);
|
||||||
Join<Feed, FeedSubscription> subJoin = feedJoin
|
|
||||||
.join(Feed_.subscriptions);
|
|
||||||
|
|
||||||
List<Predicate> predicates = Lists.newArrayList();
|
List<Predicate> predicates = Lists.newArrayList();
|
||||||
|
|
||||||
predicates.add(builder.equal(subJoin.get(FeedSubscription_.id),
|
predicates.add(builder.equal(ffeJoin.get(FeedFeedEntry_.feed),
|
||||||
subscription.getId()));
|
subscription.getFeed()));
|
||||||
|
|
||||||
if (newerThan != null) {
|
if (newerThan != null) {
|
||||||
predicates.add(builder.greaterThanOrEqualTo(
|
predicates.add(builder.greaterThanOrEqualTo(
|
||||||
|
|||||||
Reference in New Issue
Block a user