本文整理汇总了Java中com.querydsl.jpa.hibernate.HibernateQuery类的典型用法代码示例。如果您正苦于以下问题:Java HibernateQuery类的具体用法?Java HibernateQuery怎么用?Java HibernateQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HibernateQuery类属于com.querydsl.jpa.hibernate包,在下文中一共展示了HibernateQuery类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findRequirementByRootRequirementAndType
import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
public T findRequirementByRootRequirementAndType(Long rootRequirement, String type) {
QRequirementEntity requirement = new QRequirementEntity("requirement");
QFormRequirementEntity formRequirement = new QFormRequirementEntity("formRequirement");
QFormEntity form = new QFormEntity("form");
QFormTypeEntity formTypeEntity = new QFormTypeEntity("formType");
HibernateQuery<RequirementEntity> hibernateQuery = new HibernateQueryFactory(getSession())
.selectFrom(requirement)
.innerJoin(requirement.formRequirementEntities, formRequirement)
.innerJoin(formRequirement.form, form)
.innerJoin(form.formType, formTypeEntity)
.where(formRequirement.mainForm.eq(SimNao.SIM)
.and(requirement.rootRequirement.cod.eq(rootRequirement))
.and(formTypeEntity.abbreviation.eq(type)));
hibernateQuery.getMetadata().setLimit(1L);
return (T) hibernateQuery.fetchOne();
}
示例2: withPredicate
import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
protected<R> R withPredicate(Function<HibernateQuery<T>, R> toResult, Predicate... predicates) {
return transactionManager.queryDslExecuteAndReturn(query -> {
HibernateQuery<T> fetchQuery = query.selectFrom(queryDslEntity);
if(predicates != null && predicates.length > 0) {
fetchQuery.where(predicates);
}
return toResult.apply(fetchQuery);
});
}
示例3: findByCategory
import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
public List<FeedSubscription> findByCategory(User user, FeedCategory category) {
HibernateQuery<FeedSubscription> query = query().selectFrom(sub).where(sub.user.eq(user));
if (category == null) {
query.where(sub.category.isNull());
} else {
query.where(sub.category.eq(category));
}
return initRelations(query.fetch());
}
示例4: findNextUpdatable
import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
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();
}
示例5: searchCount
import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
protected long searchCount(Predicate... predicates) {
return withPredicate(HibernateQuery::fetchCount, predicates);
}
示例6: searchOne
import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
protected T searchOne(Predicate... predicates) {
return withPredicate(HibernateQuery::fetchOne, predicates);
}
示例7: HibernateQueryDslPaginable
import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
public HibernateQueryDslPaginable(TransactionManagerHibernate dbExecutor, Function<HibernateQueryFactory, HibernateQuery<T>> baseQuery) {
this.dbExecutor = dbExecutor;
this.baseQuery = baseQuery;
}
示例8: queryDslPaginate
import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
public <T> Paginable<T> queryDslPaginate(Function<HibernateQueryFactory, HibernateQuery<T>> toExecuteOnDb) {
return new HibernateQueryDslPaginable<>(this, toExecuteOnDb);
}