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


Java JPAQuery.fetch方法代码示例

本文整理汇总了Java中com.querydsl.jpa.impl.JPAQuery.fetch方法的典型用法代码示例。如果您正苦于以下问题:Java JPAQuery.fetch方法的具体用法?Java JPAQuery.fetch怎么用?Java JPAQuery.fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.querydsl.jpa.impl.JPAQuery的用法示例。


在下文中一共展示了JPAQuery.fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findAll

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
/**
 * Returns a portion of all instances.
 * Limit 0 for limitless.
 *
 * <p>
 *     Possibly less costly operation. Should be used especially if we know there is many instances or for
 *     debugging purposes.
 * </p>
 * @return {@link Collection} of instances
 */
public Collection<T> findAll(long offset, long limit) {
    JPAQuery<T> query = query().select(qObject());
    applyWhereExpression(query);

    if (offset != 0) {
        query.offset(offset);
    }
    
    if (limit != 0) {
        query.limit(limit);
    }

    List<T> list = query.fetch();

    detachAll();

    return list;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:29,代码来源:DomainStore.java

示例2: findAllInList

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
/**
 * Finds all the instances corresponding to the specified {@link List} of ids.
 *
 * <p>
 *     The returned {@link List} of instances is ordered according to the order of provided ids. If the instance
 *     with provided id is not found, it is skipped, therefore the size of returned {@link List} might be of
 *     different size that of the provided ids {@link List}.
 * </p>
 * @param ids Ordered {@link List} of ids
 * @return ordered {@link List} of instances
 */
public List<T> findAllInList(List<String> ids) {
    if (ids.isEmpty()) {
        return emptyList();
    }

    StringPath idPath = propertyPath("id");

    JPAQuery<T> query = query().select(qObject).where(idPath.in(ids));
    applyWhereExpression(query);

    List<T> list = query.fetch();

    detachAll();

    return sortByIdList(ids, list);
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:28,代码来源:DomainStore.java

示例3: list

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public <E extends GE> List<E> list(Class<E> clazz, EnabledFilter enabledFilter, Comparator<? super E> comparator) {
	PathBuilder<E> pathBuilder = new PathBuilder<E>(clazz, "rootAlias");
	QGenericLocalizedGenericListItem entityPath = new QGenericLocalizedGenericListItem(pathBuilder);
	
	JPAQuery<E> query;
	if (EnabledFilter.ENABLED_ONLY.equals(enabledFilter)) {
		query = queryByPredicate(pathBuilder, entityPath.enabled.isTrue());
	} else {
		query = queryByPredicate(pathBuilder, null);
	}
	
	List<E> entities = (List<E>) query.fetch();
	
	Collections.sort(entities, comparator);
	
	return entities;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:19,代码来源:GenericLocalizedGenericListItemDaoImpl.java

示例4: list

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public <E extends GenericListItem<?>> List<E> list(Class<E> clazz, EnabledFilter enabledFilter, Comparator<? super E> comparator) {
	PathBuilder<GenericListItem<?>> pathBuilder = new PathBuilder<GenericListItem<?>>(clazz, "rootAlias");
	QGenericListItem entityPath = new QGenericListItem(pathBuilder);
	
	JPAQuery<GenericListItem<?>> query;
	if (EnabledFilter.ENABLED_ONLY.equals(enabledFilter)) {
		query = queryByPredicate(entityPath, entityPath.enabled.isTrue());
	} else {
		query = queryByPredicate(entityPath, null);
	}
	
	@SuppressWarnings("unchecked")
	List<E> entities = (List<E>) query.fetch();
	
	Collections.sort(entities, comparator);
	
	return entities;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:20,代码来源:GenericListItemDaoImpl.java

示例5: findByUser

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
public List<Order> findByUser(User user, Integer offset, Integer limit, String orderby, Boolean isDesc, OrderStatus status) {
    JPAQuery<Order> query = new JPAQueryFactory(entityManager).selectFrom(order)
            .where(
                    order.user.eq(user),
                    status != null && status.equals(OrderStatus.CREATED) ? null : order.status.ne(OrderStatus.CREATED),
                    status != null ? order.status.eq(status) : null);

    if (offset != null)
        query.offset(offset);
    if (limit != null)
        query.limit(limit);

    sortBy(orderby, isDesc, query);

    return query.fetch();
}
 
开发者ID:remibantos,项目名称:jeeshop,代码行数:17,代码来源:OrderFinder.java

示例6: testInterval

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Test
public void testInterval() {
	JPAQuery<Person> query = new JPAQuery<>(getEntityManager());
	
	query.from(QPerson.person).where(Expressions.booleanTemplate("{0} - {1} * interval({2}) < now()", QPerson.person.creationDate, 8, "1 day"));
	
	query.fetch();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:9,代码来源:TestQueryDSLSQLConstructs.java

示例7: listOrderedByDateTypeStatus

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public List<E> listOrderedByDateTypeStatus(Date startDate, Date endDate, IExecutionType executionType, ExecutionStatus executionStatus,
		Integer limit, Integer offset) {
	Path<E> path = new EntityPathBase<E>(getObjectClass(), QAbstractExecution.abstractExecution.getMetadata());
	QAbstractExecution qAbstractExecution = new QAbstractExecution(path);
	
	BooleanBuilder builder = new BooleanBuilder();
	if (startDate != null) {
		builder.and(qAbstractExecution.startDate.gt(startDate));
	}
	if (endDate != null) {
		builder.and(qAbstractExecution.endDate.lt(endDate));
	}
	if (executionType != null) {
		builder.and(qAbstractExecution.executionType.eq(executionType));
	}
	if (executionStatus != null) {
		builder.and(qAbstractExecution.executionStatus.eq(executionStatus));
	}
	
	JPAQuery<E> jpaQuery = new JPAQuery<>(getEntityManager())
		.select(path)
		.from(qAbstractExecution)
		.orderBy(qAbstractExecution.startDate.desc());
	if (limit != null) {
		jpaQuery.limit(limit);
	}
	if (offset != null) {
		jpaQuery.offset(offset);
	}
	return jpaQuery.fetch();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:33,代码来源:AbstractExecutionDaoImpl.java

示例8: loadAll

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
@NotNull
public
List<E> loadAll(@NotNull Where<E> predicate) {
    PathBuilder<E> entity = newQueryEntity();

    JPAQuery<E> q = newQuery().from(entity);

    predicate.where(q, entity, alias(getEntityType(), entity));
    return q.fetch();
}
 
开发者ID:Tibor17,项目名称:javaee-samples,代码行数:12,代码来源:BaseDaoImpl.java

示例9: findBySearchCriteria

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
public <T extends CatalogItem> List<T> findBySearchCriteria(EntityPath<T> entityPath, String searchCriteria,
                                                            Integer offset, Integer limit, String orderBy, Boolean isDesc) {
    QCatalogItem qCatalogItem = new QCatalogItem(entityPath);

    JPAQuery<T> query = new JPAQueryFactory(entityManager).selectFrom(entityPath)
            .where(buildSearchPredicate(searchCriteria, qCatalogItem));

    addOffsetAndLimitToQuery(offset, limit, query, orderBy, isDesc, qCatalogItem);

    return query.fetch();
}
 
开发者ID:remibantos,项目名称:jeeshop,代码行数:12,代码来源:CatalogItemFinder.java

示例10: findBySearchCriteria

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
public List<User> findBySearchCriteria(String searchCriteria, Integer offset, Integer limit, String orderBy, Boolean isDesc) {
    JPAQuery<User> query = new JPAQueryFactory(entityManager).selectFrom(user)
            .where(buildSearchPredicate(searchCriteria));

    if (offset != null)
        query.offset(offset);
    if (limit != null)
        query.limit(limit);

    sortBy(orderBy, isDesc, query);

    return query.fetch();
}
 
开发者ID:remibantos,项目名称:jeeshop,代码行数:14,代码来源:UserFinder.java

示例11: listLastNotifications

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public List<ArtifactVersionNotification> listLastNotifications(User user, long limit) {
	JPAQuery<ArtifactVersionNotification> query = new JPAQuery<>(getEntityManager());
	
	query
		.select(qArtifactVersionNotification)
		.from(qArtifactVersionNotification)
		.where(qArtifactVersionNotification.user.eq(user))
		.orderBy(qArtifactVersionNotification.creationDate.desc())
		.limit(limit);
	
	return query.fetch();
}
 
开发者ID:openwide-java,项目名称:artifact-listener,代码行数:14,代码来源:UserDaoImpl.java

示例12: listNotificationsAfterDate

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public List<ArtifactVersionNotification> listNotificationsAfterDate(User user, Date date) {
	JPAQuery<ArtifactVersionNotification> query = new JPAQuery<>(getEntityManager());
	
	query
		.select(qArtifactVersionNotification)
		.from(qArtifactVersionNotification)
		.where(qArtifactVersionNotification.user.eq(user))
		.where(qArtifactVersionNotification.creationDate.after(date))
		.orderBy(qArtifactVersionNotification.creationDate.desc());
	
	return query.fetch();
}
 
开发者ID:openwide-java,项目名称:artifact-listener,代码行数:14,代码来源:UserDaoImpl.java

示例13: listByUserGroup

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public List<User> listByUserGroup(UserGroup userGroup) {
	JPAQuery<User> query = new JPAQuery<>(getEntityManager());
	QUser qUser = QUser.user;
	QUserGroup qUserGroup = QUserGroup.userGroup;
	
	query
			.select(qUser)
			.from(qUser)
			.join(qUser.groups, qUserGroup)
			.where(qUserGroup.eq(userGroup))
			.orderBy(qUser.lastName.lower().asc(), qUser.firstName.lower().asc());
	
	return query.fetch();
}
 
开发者ID:openwide-java,项目名称:artifact-listener,代码行数:16,代码来源:UserDaoImpl.java

示例14: listArtifactVersionsAfterDate

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public List<ArtifactVersion> listArtifactVersionsAfterDate(Artifact artifact, Date date) {
	JPAQuery<ArtifactVersion> query = new JPAQuery<>(getEntityManager());
	
	query.select(qArtifactVersion)
		.from(qArtifactVersion)
		.where(qArtifactVersion.artifact.eq(artifact))
		.where(qArtifactVersion.lastUpdateDate.gt(date))
		.orderBy(qArtifactVersion.lastUpdateDate.desc());
	
	return query.fetch();
}
 
开发者ID:openwide-java,项目名称:artifact-listener,代码行数:13,代码来源:ArtifactDaoImpl.java

示例15: listMostFollowedArtifacts

import com.querydsl.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public List<Artifact> listMostFollowedArtifacts(int limit) {
	JPAQuery<Artifact> query = new JPAQuery<>(getEntityManager());
	
	query
		.select(qArtifact)
		.from(qArtifact)
		.where(qArtifact.deprecationStatus.eq(ArtifactDeprecationStatus.NORMAL))
		.orderBy(qArtifact.followersCount.desc())
		.limit(limit);
	
	return query.fetch();
}
 
开发者ID:openwide-java,项目名称:artifact-listener,代码行数:14,代码来源:ArtifactDaoImpl.java


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