javax.jdo.Query.getFetchPlan()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中javax.jdo.Query.getFetchPlan方法的一些代码示例,展示了Query.getFetchPlan的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getFetchPlan方法的具体详情如下:
包路径:javax.jdo.Query
类名称:Query
方法名:getFetchPlan

Query.getFetchPlan介绍

[英]Returns the FetchPlan used by this Query. Modifications of the returned fetch plan will not cause this query's owning PersistenceManager's FetchPlan to be modified.
[中]返回此Query使用的FetchPlan。修改返回的提取计划不会导致修改此查询的所有者PersistenceManagerFetchPlan

代码示例

代码示例来源:origin: stackoverflow.com

Query query = pm.newQuery(...);
// I would use of value below 1000 (gae limit) 
query.getFetchPlan().setFetchSize(numberOfRecordByFetch);

代码示例来源:origin: com.mysema.querydsl/querydsl-jdo

private Query createQuery(boolean forCount) {
  Expression<?> source = getSource();
  // serialize
  JDOQLSerializer serializer = new JDOQLSerializer(getTemplates(), source);
  serializer.serialize(queryMixin.getMetadata(), forCount, false);
  logQuery(serializer.toString(), serializer.getConstantToLabel());
  // create Query
  Query query = persistenceManager.newQuery(serializer.toString());
  orderedConstants = serializer.getConstants();
  queries.add(query);
  if (!forCount) {
    List<? extends Expression<?>> projection = queryMixin.getMetadata().getProjection();
    if (projection.get(0) instanceof FactoryExpression) {
      this.projection = (FactoryExpression<?>)projection.get(0);
    }
    if (!fetchGroups.isEmpty()) {
      query.getFetchPlan().setGroups(fetchGroups);
    }
    if (maxFetchDepth != null) {
      query.getFetchPlan().setMaxFetchDepth(maxFetchDepth);
    }
  }
  return query;
}

相关文章