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


Java JPAQuery.list方法代码示例

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


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

示例1: iterator

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public Iterator<? extends AbstractTask> iterator(long first, long count) {
    QAbstractTask task = QAbstractTask.abstractTask;
    QWork work = task.as(QWork.class);

    JPAQuery query = new JPAQuery(page.getEntityManager());
    query.from(QAbstractTask.abstractTask).leftJoin(work.part.project);
    query.where(createPredicate());
    query.orderBy(task.date.asc());

    query.offset(first);
    query.limit(count);

    List<AbstractTask> found = query.list(task);
    if (found != null) {
        return found.iterator();
    }

    return new ArrayList<AbstractTask>().iterator();
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:21,代码来源:AbstractTaskDataProvider.java

示例2: getCustomers

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
private Map<Integer, Customer> getCustomers(List<Integer> ids) {
    Map<Integer, Customer> map = new HashMap<>();
    if (ids.isEmpty()) {
        return map;
    }

    QCustomer customer = QCustomer.customer;
    JPAQuery query = new JPAQuery(page.getEntityManager());
    query.from(customer);
    query.where(customer.id.in(ids));

    List<Customer> customers = query.list(customer);
    if (customers == null) {
        return map;
    }

    for (Customer c : customers) {
        map.put(c.getId(), c);
    }

    return map;
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:23,代码来源:SummaryPartsDataProvider.java

示例3: getProjectParts

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
private Map<Integer, Part> getProjectParts(List<Integer> ids) {
    Map<Integer, Part> map = new HashMap<>();
    if (ids.isEmpty()) {
        return map;
    }

    QPart part = QPart.part;
    JPAQuery query = new JPAQuery(page.getEntityManager());
    query.from(part);
    query.where(part.id.in(ids));

    List<Part> parts = query.list(part);
    if (parts == null) {
        return map;
    }

    for (Part p : parts) {
        map.put(p.getId(), p);
    }

    return map;
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:23,代码来源:SummaryPartsDataProvider.java

示例4: listProjectsFromDb

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
private static List<CustomerProjectPartDto> listProjectsFromDb(EntityManager entityManager) {
    QCustomer customer = QCustomer.customer;
    QProject project = QProject.project;
    QPart part = QPart.part;

    JPAQuery query = new JPAQuery(entityManager);
    query.from(customer).leftJoin(customer.projects, project).leftJoin(QProject.project.parts, part);
    query.where(QProject.project.closed.eq(false).and(part.id.isNotNull()));
    query.orderBy(customer.name.asc(), project.name.asc(), part.name.asc());

    Map<String, Expression<?>> bindings = new HashMap<>();
    bindings.put(CustomerProjectPartDto.F_CUSTOMER_ID, customer.id);
    bindings.put(CustomerProjectPartDto.F_CUSTOMER_NAME, customer.name);
    bindings.put(CustomerProjectPartDto.F_PROJECT_ID, project.id);
    bindings.put(CustomerProjectPartDto.F_PROJECT_NAME, project.name);
    bindings.put(CustomerProjectPartDto.F_PART_ID, part.id);
    bindings.put(CustomerProjectPartDto.F_PART_NAME, part.name);
    QBean projection = new QBean(CustomerProjectPartDto.class, true, bindings);

    return query.list(projection);
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:22,代码来源:GizmoUtils.java

示例5: loadData

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
public static List<AbstractTask> loadData(WorkFilterDto filter, EntityManager entityManager) {
    List<AbstractTask> data = new ArrayList<>();
    if (filter == null) {
        return data;
    }

    List<Predicate> predicates = AbstractTaskDataProvider.createPredicates(filter);

    QAbstractTask task = QAbstractTask.abstractTask;
    QWork work = task.as(QWork.class);

    JPAQuery query = new JPAQuery(entityManager);
    query.from(task).leftJoin(work.part.project);
    if (!predicates.isEmpty()) {
        BooleanBuilder where = new BooleanBuilder();
        where.orAllOf(predicates.toArray(new Predicate[predicates.size()]));
        query.where(where);
    }
    query.orderBy(task.date.asc());

    return query.list(task);
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:23,代码来源:GizmoUtils.java

示例6: checkCreditNote

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public PTCreditNoteEntity checkCreditNote(PTInvoice invoice) {

    QJPAPTCreditNoteEntity creditNoteEntity = QJPAPTCreditNoteEntity.jPAPTCreditNoteEntity;

    JPAQuery query = new JPAQuery(this.getEntityManager());

    query.from(creditNoteEntity);

    List<JPAPTCreditNoteEntity> allCns = query.list(creditNoteEntity);

    // TODO make a query to do this
    for (JPAPTCreditNoteEntity cne : allCns) {
        for (PTCreditNoteEntry cnee : cne.getEntries()) {
            if (cnee.getReference().getNumber().compareTo(invoice.getNumber()) == 0) {
                return cne;
            }
        }
    }
    return null;
}
 
开发者ID:premium-minds,项目名称:billy,代码行数:22,代码来源:DAOPTCreditNoteEntryImpl.java

示例7: checkCreditNote

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public ESCreditNoteEntity checkCreditNote(ESInvoice invoice) {

    QJPAESCreditNoteEntity creditNoteEntity = QJPAESCreditNoteEntity.jPAESCreditNoteEntity;

    JPAQuery query = new JPAQuery(this.getEntityManager());

    query.from(creditNoteEntity);

    List<JPAESCreditNoteEntity> allCns = query.list(creditNoteEntity);

    // TODO make a query to do this
    for (JPAESCreditNoteEntity cne : allCns) {
        for (ESCreditNoteEntry cnee : cne.getEntries()) {
            if (cnee.getReference().getNumber().compareTo(invoice.getNumber()) == 0) {
                return cne;
            }
        }
    }
    return null;
}
 
开发者ID:premium-minds,项目名称:billy,代码行数:22,代码来源:DAOESCreditNoteEntryImpl.java

示例8: checkCreditReceipt

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public ESCreditReceiptEntity checkCreditReceipt(ESReceipt receipt) {

    QJPAESCreditReceiptEntity creditReceiptEntity = QJPAESCreditReceiptEntity.jPAESCreditReceiptEntity;

    JPAQuery query = new JPAQuery(this.getEntityManager());

    query.from(creditReceiptEntity);

    List<JPAESCreditReceiptEntity> allCns = query.list(creditReceiptEntity);

    // TODO make a query to do this
    for (JPAESCreditReceiptEntity cne : allCns) {
        for (ESCreditReceiptEntry cnee : cne.getEntries()) {
            if (cnee.getReference().getNumber().compareTo(receipt.getNumber()) == 0) {
                return cne;
            }
        }
    }
    return null;
}
 
开发者ID:premium-minds,项目名称:billy,代码行数:22,代码来源:DAOESCreditReceiptEntryImpl.java

示例9: checkCreditNote

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public FRCreditNoteEntity checkCreditNote(FRInvoice invoice) {

    QJPAFRCreditNoteEntity creditNoteEntity = QJPAFRCreditNoteEntity.jPAFRCreditNoteEntity;

    JPAQuery query = new JPAQuery(this.getEntityManager());

    query.from(creditNoteEntity);

    List<JPAFRCreditNoteEntity> allCns = query.list(creditNoteEntity);

    // TODO make a query to do this
    for (JPAFRCreditNoteEntity cne : allCns) {
        for (FRCreditNoteEntry cnee : cne.getEntries()) {
            if (cnee.getReference().getNumber().compareTo(invoice.getNumber()) == 0) {
                return cne;
            }
        }
    }
    return null;
}
 
开发者ID:premium-minds,项目名称:billy,代码行数:22,代码来源:DAOFRCreditNoteEntryImpl.java

示例10: checkCreditReceipt

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public FRCreditReceiptEntity checkCreditReceipt(FRReceipt receipt) {

    QJPAFRCreditReceiptEntity creditReceiptEntity = QJPAFRCreditReceiptEntity.jPAFRCreditReceiptEntity;

    JPAQuery query = new JPAQuery(this.getEntityManager());

    query.from(creditReceiptEntity);

    List<JPAFRCreditReceiptEntity> allCns = query.list(creditReceiptEntity);

    // TODO make a query to do this
    for (JPAFRCreditReceiptEntity cne : allCns) {
        for (FRCreditReceiptEntry cnee : cne.getEntries()) {
            if (cnee.getReference().getNumber().compareTo(receipt.getNumber()) == 0) {
                return cne;
            }
        }
    }
    return null;
}
 
开发者ID:premium-minds,项目名称:billy,代码行数:22,代码来源:DAOFRCreditReceiptEntryImpl.java

示例11: byEventStatus

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public List<Gallery> byEventStatus(Event.Status status) {
    QGallery gallery = QGallery.gallery;
    QEvent event = QEvent.event;
    JPAQuery query = new JPAQuery(entityManager);

    query.from(gallery).join(gallery.event, event).where(event.status.eq(status.getCode()));

    query.setHint(LOAD.getKey(), entityManager.getEntityGraph("Gallery.event"));

    return query.list(gallery);
}
 
开发者ID:Hippoom,项目名称:spring-test-dbunit-template,代码行数:13,代码来源:GalleryRepositoryImpl.java

示例12: findAll

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
@Override
public List<T> findAll(Predicate predicate, Sort... sorts) {
	JPAQuery query = new JPAQuery(entityManager).from(metamodel);
	applyWhere(query, predicate);
	applySorting(query, sorts);
	return query.list(metamodel);
}
 
开发者ID:u2ware,项目名称:springfield,代码行数:8,代码来源:JpaQueryDslExecutor.java

示例13: createSummary

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
/**
 * select date_trunc('day' ,date), sum(length), sum(invoice) from tasks
 * where realizator_id=9 and date >= '2014-08-01 00:00:00' and date <= '2014-08-31 23:59:59'
 * group by date_trunc('day' ,date) order by date_trunc('day' ,date);
 *
 * @param filter
 * @return
 */
public SummaryPanelDto createSummary(WorkFilterDto filter) {
    SummaryPanelDto dto = new SummaryPanelDto(filter);

    List<Predicate> list = AbstractTaskDataProvider.createPredicates(filter);
    QAbstractTask task = QAbstractTask.abstractTask;
    QWork work = task.as(QWork.class);

    JPAQuery query = new JPAQuery(page.getEntityManager());
    query.from(task).leftJoin(work.part.project);
    if (!list.isEmpty()) {
        BooleanBuilder bb = new BooleanBuilder();
        bb.orAllOf(list.toArray(new Predicate[list.size()]));
        query.where(bb);
    }
    query.groupBy(createDateTruncExpression(work));

    List<Tuple> tuples = query.list(createDateTruncExpression(work),
            task.workLength.sum(), work.invoiceLength.sum());
    if (tuples != null) {
        for (Tuple tuple : tuples) {
            TaskLength taskLength = new TaskLength(tuple.get(1, Double.class), tuple.get(2, Double.class));
            dto.getDates().put(tuple.get(0, Date.class), taskLength);
        }
    }

    return dto;
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:36,代码来源:SummaryDataProvider.java

示例14: createSummary

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
public List<PartSummary> createSummary(WorkFilterDto filter) {
    List<Predicate> list = AbstractTaskDataProvider.createPredicates(filter);
    QAbstractTask task = QAbstractTask.abstractTask;
    QWork work = task.as(QWork.class);
    QLog log = task.as(QLog.class);

    JPAQuery query = new JPAQuery(page.getEntityManager());
    query.from(task).leftJoin(work.part.project);
    if (!list.isEmpty()) {
        BooleanBuilder bb = new BooleanBuilder();
        bb.orAllOf(list.toArray(new Predicate[list.size()]));
        query.where(bb);
    }
    query.groupBy(work.part.id, log.customer.id);

    List<Tuple> tuples = query.list(work.part.id, log.customer.id,
            task.workLength.sum(), work.invoiceLength.sum());
    List<PartSummary> result = new ArrayList<>();
    if (tuples != null) {
        LOG.debug("Found {} parts for summary.", tuples.size());

        processSummaryResults(tuples, result);
    }

    Collections.sort(result);

    return result;
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:29,代码来源:SummaryPartsDataProvider.java

示例15: getChildContexts

import com.mysema.query.jpa.impl.JPAQuery; //导入方法依赖的package包/类
private List<JPAPTRegionContextEntity> getChildContexts(PTRegionContextEntity parentContext) {
    QJPAPTRegionContextEntity contexts = QJPAPTRegionContextEntity.jPAPTRegionContextEntity;
    JPAQuery query = new JPAQuery(this.getEntityManager());

    query.from(contexts).where(contexts.parent.eq(parentContext));
    return query.list(contexts);
}
 
开发者ID:premium-minds,项目名称:billy,代码行数:8,代码来源:DAOPTTaxImpl.java


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