本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}