mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
merge push infos into feeds
This commit is contained in:
@@ -7,7 +7,6 @@ import java.util.List;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
@@ -60,7 +59,6 @@ public class FeedDAO extends GenericDAO<Feed> {
|
||||
Root<Feed> root = query.from(getType());
|
||||
|
||||
query.where(getUpdatablePredicates(root).toArray(new Predicate[0]));
|
||||
root.fetch(Feed_.pushInfo, JoinType.LEFT);
|
||||
|
||||
query.orderBy(builder.asc(root.get(Feed_.lastUpdated)));
|
||||
|
||||
@@ -88,4 +86,8 @@ public class FeedDAO extends GenericDAO<Feed> {
|
||||
criteria.setMaxResults(limit);
|
||||
return criteria.getSingleResult();
|
||||
}
|
||||
|
||||
public List<Feed> findByTopic(String topic) {
|
||||
return findByField(Feed_.pushTopic, topic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.commafeed.backend.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import com.commafeed.backend.model.FeedPushInfo;
|
||||
import com.commafeed.backend.model.FeedPushInfo_;
|
||||
|
||||
@Stateless
|
||||
public class FeedPushInfoDAO extends GenericDAO<FeedPushInfo> {
|
||||
|
||||
public List<FeedPushInfo> findByTopic(String topic, boolean includeFeed) {
|
||||
|
||||
CriteriaQuery<FeedPushInfo> query = builder.createQuery(getType());
|
||||
Root<FeedPushInfo> root = query.from(getType());
|
||||
if (includeFeed) {
|
||||
root.fetch(FeedPushInfo_.feed);
|
||||
}
|
||||
query.where(builder.equal(root.get(FeedPushInfo_.topic), topic));
|
||||
|
||||
TypedQuery<FeedPushInfo> q = em.createQuery(query);
|
||||
return q.getResultList();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user