Java Examples for com.querydsl.jpa.JPAExpressions

The following java examples will help you to understand the usage of com.querydsl.jpa.JPAExpressions. These source code samples are taken from different open source projects.

Example 1
Project: commafeed-master  File: FeedDAO.java View source code
public List<Feed> findNextUpdatable(int count, Date lastLoginThreshold) {
    HibernateQuery<Feed> query = query().selectFrom(feed);
    query.where(feed.disabledUntil.isNull().or(feed.disabledUntil.lt(new Date())));
    if (lastLoginThreshold != null) {
        QFeedSubscription subs = QFeedSubscription.feedSubscription;
        QUser user = QUser.user;
        JPQLQuery<Integer> subQuery = JPAExpressions.selectOne().from(subs);
        subQuery.join(subs.user, user).where(user.lastLogin.gt(lastLoginThreshold));
        query.where(subQuery.exists());
    }
    return query.orderBy(feed.disabledUntil.asc()).limit(count).distinct().fetch();
}
Example 2
Project: kylo-master  File: JpaBatchJobExecutionProvider.java View source code
private Page<? extends BatchJobExecution> findAllForFeed(String feedName, List<SearchCriteria> filters, Pageable pageable) {
    QJpaBatchJobExecution jobExecution = QJpaBatchJobExecution.jpaBatchJobExecution;
    QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
    QJpaOpsManagerFeed checkDataFeed = new QJpaOpsManagerFeed("checkDataFeed");
    QJpaBatchJobInstance jobInstance = QJpaBatchJobInstance.jpaBatchJobInstance;
    JPQLQuery checkFeedQuery = JPAExpressions.select(checkDataFeed.id).from(feed).join(feed.checkDataFeeds, checkDataFeed).where(feed.name.eq(feedName));
    JPAQuery query = factory.select(jobExecution).from(jobExecution).join(jobExecution.jobInstance, jobInstance).join(jobInstance.feed, feed).where((feed.name.eq(feedName).or(feed.id.in(checkFeedQuery))).and(GenericQueryDslFilter.buildFilter(jobExecution, filters).and(augment(feed.id)))).fetchAll();
    pageable = CommonFilterTranslations.resolveSortFilters(jobExecution, pageable);
    return findAll(query, pageable);
}
Example 3
Project: querydsl-master  File: AbstractJPATest.java View source code
@Test
@Ignore
public void type() {
    assertEquals(Arrays.asList("C", "C", "C", "C", "C", "C", "A"), query().from(animal).orderBy(animal.id.asc()).select(JPAExpressions.type(animal)).fetch());
}