Class TQAssocBean<T,​R>

  • Type Parameters:
    T - the entity bean type (normal entity bean type e.g. Customer)
    R - the specific root query bean type (e.g. QCustomer)

    public abstract class TQAssocBean<T,​R>
    extends TQProperty<R>
    Base type for associated beans.
    • Constructor Detail

      • TQAssocBean

        public TQAssocBean​(String name,
                           R root)
        Construct with a property name and root instance.
        Parameters:
        name - the name of the property
        root - the root query bean instance
    • Method Detail

      • fetch

        public R fetch()
        Eagerly fetch this association fetching all the properties.
      • fetchQuery

        public R fetchQuery()
        Eagerly fetch this association using a "query join".
      • fetchCache

        public R fetchCache()
        Eagerly fetch this association using L2 bean cache. Cache misses are populated via fetchQuery().
      • fetchLazy

        public R fetchLazy()
        Use lazy loading for fetching this association.
      • fetch

        public R fetch​(String properties)
        Eagerly fetch this association with the properties specified.
      • fetchQuery

        public R fetchQuery​(String properties)
        Eagerly fetch this association using a "query join" with the properties specified.
      • fetchCache

        public R fetchCache​(String properties)
        Eagerly fetch this association using L2 cache with the properties specified. Cache misses are populated via fetchQuery().
      • fetchAll

        public R fetchAll()
        Deprecated.
        Deprecated in favor of fetch().
      • eq

        public R eq​(T other)
        Is equal to by ID property.
      • equalTo

        public R equalTo​(T other)
        Is equal to by ID property.
      • ne

        public R ne​(T other)
        Is not equal to by ID property.
      • notEqualTo

        public R notEqualTo​(T other)
        Is not equal to by ID property.
      • filterMany

        public R filterMany​(io.ebean.ExpressionList<T> filter)
        Apply a filter when fetching these beans.
      • filterMany

        public R filterMany​(String expressions,
                            Object... params)
        Apply a filter when fetching these beans.

        The expressions can use any valid Ebean expression and contain placeholders for bind values using ? or ?1 style.

        
        
             new QCustomer()
               .name.startsWith("Postgres")
               .contacts.filterMany("firstName istartsWith ?", "Rob")
               .findList();
        
         
        
        
             new QCustomer()
               .name.startsWith("Postgres")
               .contacts.filterMany("whenCreated inRange ? to ?", startDate, endDate)
               .findList();
        
         
        Parameters:
        expressions - The expressions including and, or, not etc with ? and ?1 bind params.
        params - The bind parameter values
      • isEmpty

        public R isEmpty()
        Is empty for a collection property.

        This effectively adds a not exists sub-query on the collection property.

        This expression only works on OneToMany and ManyToMany properties.

      • isNotEmpty

        public R isNotEmpty()
        Is not empty for a collection property.

        This effectively adds an exists sub-query on the collection property.

        This expression only works on OneToMany and ManyToMany properties.