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

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

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

Query.select介绍

[英]Apply the fetchGroup which defines what part of the object graph to load.
[中]应用fetchGroup,它定义要加载的对象图的哪个部分。

代码示例

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

@Override
public Query<T> select(String fetchProperties) {
 return query.select(fetchProperties);
}

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

@Override
public Query<T> select(FetchGroup fetchGroup) {
 return query.select(fetchGroup);
}

代码示例来源: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

/**
 * 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, DeleteMode deleteMode) {
 Query<?> q = server.createQuery(desc.getBeanType());
 StringBuilder sb = new StringBuilder(30);
 for (BeanPropertyAssocOne<?> aPropImportDelete : propImportDelete) {
  sb.append(aPropImportDelete.getName()).append(",");
 }
 q.setAutoTune(false);
 q.select(sb.toString());
 if (deleteMode.isHard() && desc.isSoftDelete()) {
  // hard delete so we want this query to include logically deleted rows (if any)
  q.setIncludeSoftDeletes();
 }
 return q;
}

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

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

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

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

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

@Override
public Query<MODEL_TYPE> select(FetchGroup<MODEL_TYPE> fetchGroup) {
  q.select(fetchGroup);
  qReadOnly.select(fetchGroup);
  return this;
}

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

@Override
public Query<T> select(String fetchProperties) {
 return query.select(fetchProperties);
}

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

@Override
public Query<T> select(FetchGroup fetchGroup) {
 return query.select(fetchGroup);
}

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

/**
 * Fetch the outline bean with associated one and associated many beans loaded with Id values only.
 * <p>
 * We use the Id values to determine what are inserts, updates and deletes as part of the merge.
 */
private EntityBean fetchOutline(Set<String> paths) {
 Query<?> query = server.find(desc.getBeanType());
 query.setBeanCacheMode(CacheMode.OFF);
 query.setPersistenceContextScope(PersistenceContextScope.QUERY);
 query.setId(desc.getId(bean));
 query.select(desc.getIdProperty().getName());
 for (String path : paths) {
  MergeNode node = buildNode(path);
  node.addSelectId(query);
 }
 return (EntityBean) server.findOne(query, transaction);
}

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

/**
 * Explicitly set a comma delimited list of the properties to fetch on the
 * 'main' root level entity bean (aka partial object). Note that '*' means all
 * properties.
 * <p>
 * You use {@link #fetch(String, String)} to specify specific properties to fetch
 * on other non-root level paths of the object graph.
 * </p>
 * <p>
 * <pre>{@code
 *
 * List<Customer> customers =
 *     new QCustomer()
 *     // Only fetch the customer id, name and status.
 *     // This is described as a "Partial Object"
 *     .select("name, status")
 *     .name.ilike("rob%")
 *     .findList();
 *
 * }</pre>
 *
 * @param properties the properties to fetch for this bean (* = all properties).
 */
public R select(String properties) {
 query.select(properties);
 return root;
}

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

/**
 * Set a FetchGroup to control what part of the object graph is loaded.
 * <p>
 * This is an alternative to using select() and fetch() providing a nice clean separation
 * between what a query should load and the query predicates.
 * </p>
 *
 * <pre>{@code
 *
 * FetchGroup<Customer> fetchGroup = FetchGroup.of(Customer.class)
 *   .select("name, status")
 *   .fetch("contacts", "firstName, lastName, email")
 *   .build();
 *
 * List<Customer> customers =
 *
 *   new QCustomer()
 *   .select(fetchGroup)
 *   .findList();
 *
 * }</pre>
 */
public R select(FetchGroup<T> fetchGroup) {
 query.select(fetchGroup);
 return root;
}

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

return find(type).select(idProp.getName()).setId(id).findOne();

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

/**
 * {@inheritDoc}
 * Explicitly sets a comma delimited list of the properties to fetch on the 'main' entity bean, to load a partial object.
 */
public Query<T> select(String fetchProperties) {
  return query().select(fetchProperties);
}

代码示例来源:origin: io.ebean/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: io.ebean/ebean-querybean

query.select(selectProps.toString());
return root;

代码示例来源: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);
      }
    });
  }
}

代码示例来源:origin: io.ebean/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, DeleteMode deleteMode) {
 Query<?> q = server.createQuery(desc.getBeanType());
 StringBuilder sb = new StringBuilder(30);
 for (BeanPropertyAssocOne<?> aPropImportDelete : propImportDelete) {
  sb.append(aPropImportDelete.getName()).append(",");
 }
 q.setAutoTune(false);
 q.select(sb.toString());
 if (deleteMode.isHard() && desc.isSoftDelete()) {
  // hard delete so we want this query to include logically deleted rows (if any)
  q.setIncludeSoftDeletes();
 }
 return q;
}

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

/**
 * Fetch the outline bean with associated one and associated many beans loaded with Id values only.
 * <p>
 * We use the Id values to determine what are inserts, updates and deletes as part of the merge.
 */
private EntityBean fetchOutline(Set<String> paths) {
 Query<?> query = server.find(desc.getBeanType());
 query.setBeanCacheMode(CacheMode.OFF);
 query.setPersistenceContextScope(PersistenceContextScope.QUERY);
 query.setId(desc.getId(bean));
 query.select(desc.getIdProperty().getName());
 for (String path : paths) {
  MergeNode node = buildNode(path);
  node.addSelectId(query);
 }
 return (EntityBean) server.findOne(query, transaction);
}

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

return find(type).select(idProp.getName()).setId(id).findOne();

相关文章

Query类方法