当前位置: 首页>>代码示例>>Java>>正文


Java HibernateQuery类代码示例

本文整理汇总了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();
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:19,代码来源:RequirementDAO.java

示例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);
	});
}
 
开发者ID:Coreoz,项目名称:Plume,代码行数:12,代码来源:CrudDaoHibernate.java

示例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());
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:10,代码来源:FeedSubscriptionDAO.java

示例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();
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:16,代码来源:FeedDAO.java

示例5: searchCount

import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
protected long searchCount(Predicate... predicates) {
	return withPredicate(HibernateQuery::fetchCount, predicates);
}
 
开发者ID:Coreoz,项目名称:Plume,代码行数:4,代码来源:CrudDaoHibernate.java

示例6: searchOne

import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
protected T searchOne(Predicate... predicates) {
	return withPredicate(HibernateQuery::fetchOne, predicates);
}
 
开发者ID:Coreoz,项目名称:Plume,代码行数:4,代码来源:CrudDaoHibernate.java

示例7: HibernateQueryDslPaginable

import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
public HibernateQueryDslPaginable(TransactionManagerHibernate dbExecutor, Function<HibernateQueryFactory, HibernateQuery<T>> baseQuery) {
	this.dbExecutor = dbExecutor;
	this.baseQuery = baseQuery;
}
 
开发者ID:Coreoz,项目名称:Plume,代码行数:5,代码来源:HibernateQueryDslPaginable.java

示例8: queryDslPaginate

import com.querydsl.jpa.hibernate.HibernateQuery; //导入依赖的package包/类
public <T> Paginable<T> queryDslPaginate(Function<HibernateQueryFactory, HibernateQuery<T>> toExecuteOnDb) {
	return new HibernateQueryDslPaginable<>(this, toExecuteOnDb);
}
 
开发者ID:Coreoz,项目名称:Plume,代码行数:4,代码来源:TransactionManagerHibernate.java


注:本文中的com.querydsl.jpa.hibernate.HibernateQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。