io.ebean.Query.fetch()方法的使用及代码示例

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

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

Query.fetch介绍

[英]Specify a path to fetch eagerly including all its properties.

Ebean will endeavour to fetch this path using a SQL join. If Ebean determines that it can not use a SQL join (due to maxRows or because it would result in a cartesian product) Ebean will automatically convert this fetch query into a "query join" - i.e. use fetchQuery().

// fetch customers (their id, name and status)

[中]指定一个路径,以便立即获取它的所有属性。
Ebean将努力使用SQL连接获取此路径。如果Ebean确定它不能使用SQL连接(由于maxRows或因为它将导致笛卡尔积),那么Ebean将自动将此获取查询转换为“查询连接”——即使用fetchQuery()。

// fetch customers (their id, name and status)

代码示例

代码示例来源:origin: ebean-orm/ebean

/**
 * Apply these path properties as fetch paths to the query.
 */
@Override
public <T> void apply(Query<T> query) {
 for (Entry<String, Props> entry : pathMap.entrySet()) {
  String path = entry.getKey();
  String props = entry.getValue().getPropertiesAsString();
  if (path == null || path.isEmpty()) {
   query.select(props);
  } else {
   query.fetch(path, props);
  }
 }
}

代码示例来源:origin: ebean-orm/ebean

/**
 * Add to the query to fetch the Ids values for the foreign keys basically.
 */
void addSelectId(Query<?> query) {
 BeanProperty idProperty = targetDescriptor.getIdProperty();
 query.fetch(fullPath, idProperty.getName());
}

代码示例来源:origin: ebean-orm/ebean

/**
  * Fetch draftable element relationships.
  */
 public void draftQueryOptimise(Query<T> query) {

  BeanPropertyAssocOne<?>[] one = desc.propertiesOne();
  for (BeanPropertyAssocOne<?> anOne : one) {
   if (anOne.getTargetDescriptor().isDraftableElement()) {
    query.fetch(anOne.getName());
   }
  }

  BeanPropertyAssocMany<?>[] many = desc.propertiesMany();
  for (BeanPropertyAssocMany<?> aMany : many) {
   if (aMany.getTargetDescriptor().isDraftableElement()) {
    query.fetch(aMany.getName());
   }
  }

 }
}

代码示例来源:origin: org.actframework/act-ebean2

@Override
public EbeanQuery<MODEL_TYPE> fetch(String path) {
  q.fetch(path);
  return this;
}

代码示例来源:origin: org.actframework/act-ebean

@Override
public EbeanQuery<MODEL_TYPE> fetch(String path, String fetchProperties) {
  q.fetch(path, fetchProperties);
  qReadOnly.fetch(path, fetchProperties);
  return this;
}

代码示例来源:origin: org.actframework/act-ebean2

@Override
public EbeanQuery<MODEL_TYPE> fetch(String assocProperty, String fetchProperties, FetchConfig fetchConfig) {
  q.fetch(assocProperty, fetchProperties, fetchConfig);
  return this;
}

代码示例来源:origin: org.actframework/act-ebean

@Override
public EbeanQuery<MODEL_TYPE> fetch(String path, FetchConfig joinConfig) {
  q.fetch(path, joinConfig);
  qReadOnly.fetch(path, joinConfig);
  return this;
}

代码示例来源:origin: org.actframework/act-ebean

@Override
public EbeanQuery<MODEL_TYPE> fetch(String assocProperty, String fetchProperties, FetchConfig fetchConfig) {
  q.fetch(assocProperty, fetchProperties, fetchConfig);
  qReadOnly.fetch(assocProperty, fetchProperties, fetchConfig);
  return this;
}

代码示例来源:origin: org.actframework/act-ebean

@Override
public EbeanQuery<MODEL_TYPE> fetch(String path) {
  q.fetch(path);
  qReadOnly.fetch(path);
  return this;
}

代码示例来源:origin: org.actframework/act-ebean2

@Override
public EbeanQuery<MODEL_TYPE> fetch(String path, String fetchProperties) {
  q.fetch(path, fetchProperties);
  return this;
}

代码示例来源:origin: org.actframework/act-ebean2

@Override
public EbeanQuery<MODEL_TYPE> fetch(String path, FetchConfig joinConfig) {
  q.fetch(path, joinConfig);
  return this;
}

代码示例来源:origin: icode/ameba

/**
 * {@inheritDoc}
 * Specifies a path to fetch with a specific list properties to include, to load a partial object.
 */
public Query<T> fetch(String path, String fetchProperties) {
  return query().fetch(path, fetchProperties);
}

代码示例来源:origin: io.ebean/ebean-querybean

/**
 * Eagerly fetch this association with the properties specified.
 */
public R fetch(String properties) {
 ((TQRootBean) _root).query().fetch(_name, properties);
 return _root;
}

代码示例来源:origin: icode/ameba

/**
 * {@inheritDoc}
 * Additionally specifies a <code>FetchConfig</code> to use a separate query or lazy loading to load this path.
 */
public Query<T> fetch(String assocProperty, String fetchProperties, FetchConfig fetchConfig) {
  return query().fetch(assocProperty, fetchProperties, fetchConfig);
}

代码示例来源:origin: icode/ameba

/**
 * {@inheritDoc}
 * <p>
 * Additionally specifies a <code>JoinConfig</code> to specify a 'query join' and/or define the lazy loading query.
 *
 * @param path       a {@link java.lang.String} object.
 * @param joinConfig a {@link io.ebean.FetchConfig} object.
 * @return a {@link io.ebean.Query} object.
 */
public Query<T> fetch(String path, FetchConfig joinConfig) {
  return query().fetch(path, joinConfig);
}

代码示例来源:origin: io.ebean/ebean-querybean

/**
 * Eagerly fetch this association fetching all the properties.
 */
public R fetch() {
 ((TQRootBean) _root).query().fetch(_name);
 return _root;
}

代码示例来源:origin: icode/ameba

/**
 * {@inheritDoc}
 * Specifies a path to load including all its properties.
 */
public Query<T> fetch(String path) {
  return query().fetch(path);
}

代码示例来源:origin: io.ebean/ebean-querybean

/**
 * Eagerly fetch this association fetching some of the properties.
 */
protected R fetchProperties(TQProperty<?>... props) {
 ((TQRootBean) _root).query().fetch(_name, properties(props));
 return _root;
}

代码示例来源:origin: io.ebean/ebean

/**
 * Add to the query to fetch the Ids values for the foreign keys basically.
 */
void addSelectId(Query<?> query) {
 BeanProperty idProperty = targetDescriptor.getIdProperty();
 query.fetch(fullPath, idProperty.getName());
}

代码示例来源:origin: icode/ameba

/** {@inheritDoc} */
  @Override
  public <T> void apply(final Query<T> query) {
    pathProperties.each(props -> {
      String path = props.getPath();
      String propsStr = props.getPropertiesAsString();

      if (path == null || path.isEmpty()) {
        query.select(propsStr);
      } else {
        query.fetch(path, propsStr);
      }
    });
  }
}

相关文章

Query类方法