remove rxjava as its too magic and very hard to master

This commit is contained in:
Athou
2023-05-22 15:26:20 +02:00
parent 85ebcd6407
commit e84a1289e3
4 changed files with 147 additions and 48 deletions

View File

@@ -42,6 +42,10 @@ public class FeedDAO extends GenericDAO<Feed> {
return query.orderBy(feed.disabledUntil.asc()).limit(count).fetch();
}
public void setDisabledUntil(List<Long> feedIds, Date date) {
updateQuery(feed).set(feed.disabledUntil, date).where(feed.id.in(feedIds)).execute();
}
public Feed findByUrl(String normalizedUrl) {
List<Feed> feeds = query().selectFrom(feed).where(feed.normalizedUrlHash.eq(DigestUtils.sha1Hex(normalizedUrl))).fetch();
Feed feed = Iterables.getFirst(feeds, null);

View File

@@ -6,8 +6,10 @@ import org.hibernate.SessionFactory;
import org.hibernate.annotations.QueryHints;
import com.commafeed.backend.model.AbstractModel;
import com.querydsl.core.types.EntityPath;
import com.querydsl.jpa.impl.JPAQuery;
import com.querydsl.jpa.impl.JPAQueryFactory;
import com.querydsl.jpa.impl.JPAUpdateClause;
import io.dropwizard.hibernate.AbstractDAO;
@@ -24,6 +26,10 @@ public abstract class GenericDAO<T extends AbstractModel> extends AbstractDAO<T>
return factory;
}
protected JPAUpdateClause updateQuery(EntityPath<T> entityPath) {
return new JPAUpdateClause(currentSession(), entityPath);
}
public void saveOrUpdate(T model) {
persist(model);
}