ebean-orm-deprecated / ebean-querybean

Moved as a module into ebean.git repo
https://ebean.io/docs/query/query-beans
Apache License 2.0
9 stars 3 forks source link

Add methods setUseDocStore(), setDisableLazyLoading(), setDisableReadAuditing(), validate() ... to query root bean type #16

Closed rbygrave closed 8 years ago

rbygrave commented 8 years ago

The setUseDocStore() requires Ebean 7.1.1 so going to bump the version to match that.


  /**
   * Set to true if this query should execute against the doc store.
   * <p>
   * When setting this you may also consider disabling lazy loading.
   * </p>
   */
  public R setUseDocStore(boolean useDocStore) {
    query.setUseDocStore(useDocStore);
    return root;
  }

  /**
   * Set true if you want to disable lazy loading.
   * <p>
   * That is, once the object graph is returned further lazy loading is disabled.
   * </p>
   */
  public R setDisableLazyLoading(boolean disableLazyLoading) {
    query.setDisableLazyLoading(disableLazyLoading);
    return root;
  }

  /**
   * Disable read auditing for this query.
   * <p>
   * This is intended to be used when the query is not a user initiated query and instead
   * part of the internal processing in an application to load a cache or document store etc.
   * In these cases we don't want the query to be part of read auditing.
   * </p>
   */
  public R setDisableReadAuditing() {
    query.setDisableReadAuditing();
    return root;
  }

  /**
   * Returns the set of properties or paths that are unknown (do not map to known properties or paths).
   * <p>
   * Validate the query checking the where and orderBy expression paths to confirm if
   * they represent valid properties or paths for the given bean type.
   * </p>
   */
  public Set<String> validate() {
    return query.validate();
  }
rbygrave commented 8 years ago

e.g. 

Hit the doc store (ElasticSearch) where name matches "rob" ... returning pagedList with total hits and list of customer.

    new QCustomer()
        .name.contains("rob")
        .setUseDocStore(true)
        .setMaxRows(10)
        .findPagedList();