Package io.jmix.core

Class FluentLoader.ByQuery<E>

java.lang.Object
io.jmix.core.FluentLoader.ByQuery<E>
Enclosing class:
FluentLoader<E>

public static class FluentLoader.ByQuery<E> extends Object
  • Constructor Details

    • ByQuery

      protected ByQuery(FluentLoader<E> loader, String queryString, org.springframework.context.ApplicationContext applicationContext)
    • ByQuery

      protected ByQuery(FluentLoader<E> loader, String queryString, Object[] positionalParams, org.springframework.context.ApplicationContext applicationContext)
  • Method Details

    • list

      public List<E> list()
      Loads a list of entities.
    • optional

      public Optional<E> optional()
      Loads a single instance and wraps it in Optional.
    • one

      public E one()
      Loads a single instance.
      Throws:
      IllegalStateException - if nothing was loaded
    • fetchPlan

      public FluentLoader.ByQuery<E> fetchPlan(@Nullable FetchPlan fetchPlan)
      Sets a fetch plan.
    • fetchPlan

      public FluentLoader.ByQuery<E> fetchPlan(@Nullable String fetchPlanName)
      Sets a fetchPlan by name.
    • fetchPlan

      public FluentLoader.ByQuery<E> fetchPlan(Consumer<FetchPlanBuilder> fetchPlanBuilderConfigurer)
      Configure the fetch plan.
    • fetchPlanProperties

      public FluentLoader.ByQuery<E> fetchPlanProperties(String... properties)
      Sets a fetch plan containing the given properties. A property can be designated by a path in the entity graph. For example:
           dataManager.load(Pet.class)
               .query("...")
               .fetchPlanProperties(
                       "name",
                       "owner.name",
                       "owner.address.city")
               .list();
       
    • hint

      public FluentLoader.ByQuery<E> hint(String hintName, Serializable value)
      Adds custom hint that should be used by the query.
    • hints

      public FluentLoader.ByQuery<E> hints(Map<String,Serializable> hints)
      Adds custom hints that should be used by the query.
    • condition

      public FluentLoader.ByCondition<E> condition(Condition condition)
      Sets additional query condition.
    • parameter

      public FluentLoader.ByQuery<E> parameter(String name, @Nullable Object value)
      Sets value for a query parameter.
      Parameters:
      name - parameter name
      value - parameter value
    • parameter

      public FluentLoader.ByQuery<E> parameter(String name, @Nullable Date value, javax.persistence.TemporalType temporalType)
      Sets value for a parameter of java.util.Date type.
      Parameters:
      name - parameter name
      value - parameter value
      temporalType - how to interpret the value
    • parameters

      public FluentLoader.ByQuery<E> parameters(Map<String,Object> parameters)
      Adds the given parameters to the map of query parameters.
    • firstResult

      public FluentLoader.ByQuery<E> firstResult(int firstResult)
      Sets results offset.
    • maxResults

      public FluentLoader.ByQuery<E> maxResults(int maxResults)
      Sets results limit.
    • sort

      public FluentLoader.ByQuery<E> sort(Sort sort)
      Sets sorting, for example sort(Sort.by("name"))
    • cacheable

      public FluentLoader.ByQuery<E> cacheable(boolean cacheable)
      Indicates that the query results should be cached. By default, queries are not cached.
    • accessConstraints

      public FluentLoader.ByQuery<E> accessConstraints(Collection<AccessConstraint<?>> accessConstraints)
      Adds access constraints.
    • accessConstraints

      public FluentLoader.ByQuery<E> accessConstraints(Class<? extends AccessConstraint> accessConstraintsClass)
      Adds registered access constraints that are subclasses of the given class.
    • joinTransaction

      public FluentLoader.ByQuery<E> joinTransaction(boolean join)
      Indicates that the operation must be performed in an existing transaction if it exists. True by default.
    • lockMode

      public FluentLoader.ByQuery<E> lockMode(javax.persistence.LockModeType lockMode)
      Sets a lock mode to be used when executing query.