com.avaje.ebean.Query.setAutofetch()方法的使用及代码示例

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

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

Query.setAutofetch介绍

[英]Explicitly specify whether to use Autofetch for this query.

If you do not call this method on a query the "Implicit Autofetch mode" is used to determine if Autofetch should be used for a given query.

Autofetch can add additional fetch paths to the query and specify which properties are included for each path. If you have explicitly defined some fetch paths Autofetch will not remove.
[中]

代码示例

代码示例来源:origin: com.typesafe.play/play-java-ebean

/**
 * Explicitly specifies whether to use 'Autofetch' for this query.
 */
public Query<T> setAutofetch(boolean autofetch) {
  return query().setAutofetch(autofetch);
}

代码示例来源:origin: org.avaje/ebean

/**
 * We need to create and execute a query to get the foreign key values as
 * the delete cascades to them (foreign keys).
 */
private Query<?> deleteRequiresQuery(BeanDescriptor<?> desc, BeanPropertyAssocOne<?>[] propImportDelete) {
  Query<?> q = server.createQuery(desc.getBeanType());
  StringBuilder sb = new StringBuilder(30);
  for (int i = 0; i < propImportDelete.length; i++) {
    sb.append(propImportDelete[i].getName()).append(",");
  }
  q.setAutofetch(false);
  q.select(sb.toString());
  return q;
}

代码示例来源:origin: org.avaje.ebeanorm/avaje-ebeanorm-server

/**
 * We need to create and execute a query to get the foreign key values as
 * the delete cascades to them (foreign keys).
 */
private Query<?> deleteRequiresQuery(BeanDescriptor<?> desc, BeanPropertyAssocOne<?>[] propImportDelete) {
  Query<?> q = server.createQuery(desc.getBeanType());
  StringBuilder sb = new StringBuilder(30);
  for (int i = 0; i < propImportDelete.length; i++) {
    sb.append(propImportDelete[i].getName()).append(",");
  }
  q.setAutofetch(false);
  q.select(sb.toString());
  return q;
}

相关文章