Interface From<Z,X>

Type Parameters:
Z - the source type
X - the target type
All Superinterfaces:
Expression<X>, FetchParent<Z,X>, Path<X>, Selection<X>, TupleElement<X>
All Known Subinterfaces:
CollectionJoin<Z,E>, Join<Z,X>, ListJoin<Z,E>, MapJoin<Z,K,V>, PluralJoin<Z,C,E>, Root<X>, SetJoin<Z,E>

public interface From<Z,X> extends Path<X>, FetchParent<Z,X>
Represents a bound type, usually an entity that appears in the from clause, but may also be an embeddable belonging to an entity in the from clause.

Serves as a factory for Joins of associations, embeddables, and collections belonging to the type, and for Paths of attributes belonging to the type.

Since:
2.0
  • Method Details

    • getJoins

      @Nonnull Set<Join<X,?>> getJoins()
      Return the joins that have been made from this bound type. Returns empty set if no joins have been made from this bound type. Modifications to the set do not affect the query.
      Returns:
      joins made from this type
    • isCorrelated

      boolean isCorrelated()
      Whether the From object has been obtained as a result of correlation (use of a Subquery.correlate(From) method).
      Returns:
      boolean indicating whether the object has been obtained through correlation
    • getCorrelationParent

      @Nonnull From<Z,X> getCorrelationParent()
      Returns the parent From object from which the correlated From object has been obtained through correlation (use of Subquery.correlate(From) method).
      Returns:
      the parent of the correlated From object
      Throws:
      IllegalStateException - if the From object has not been obtained through correlation
    • join

      @Nonnull <Y> Join<X,Y> join(@Nonnull Class<Y> entityClass)
      Create and add an inner join to the given entity.
      Type Parameters:
      Y - the target entity type
      Parameters:
      entityClass - the target entity class
      Returns:
      the resulting join
      Since:
      3.2
    • join

      @Nonnull <Y> Join<X,Y> join(@Nonnull Class<Y> entityClass, @Nonnull JoinType joinType)
      Create and add a join to the given entity.
      Type Parameters:
      Y - the target entity type
      Parameters:
      entityClass - the target entity class
      joinType - join type
      Returns:
      the resulting join
      Since:
      3.2
    • join

      @Nonnull <Y> Join<X,Y> join(@Nonnull EntityType<Y> entity)
      Create and add an inner join to the given entity.
      Type Parameters:
      Y - the target entity type
      Parameters:
      entity - metamodel entity representing the join target
      Returns:
      the resulting join
      Since:
      3.2
    • join

      @Nonnull <Y> Join<X,Y> join(@Nonnull EntityType<Y> entity, @Nonnull JoinType joinType)
      Create and add a join to the given entity.
      Type Parameters:
      Y - the target entity type
      Parameters:
      entity - metamodel entity representing the join target
      joinType - join type
      Returns:
      the resulting join
      Since:
      3.2
    • join

      @Nonnull <Y> Join<X,Y> join(@Nonnull SingularAttribute<? super X, Y> attribute)
      Create an inner join to the specified single-valued attribute.
      Type Parameters:
      Y - the type of the joined attribute
      Parameters:
      attribute - target of the join
      Returns:
      the resulting join
    • join

      @Nonnull <Y> Join<X,Y> join(@Nonnull SingularAttribute<? super X, Y> attribute, @Nonnull JoinType jt)
      Create a join to the specified single-valued attribute using the given join type.
      Type Parameters:
      Y - the type of the joined attribute
      Parameters:
      attribute - target of the join
      jt - join type
      Returns:
      the resulting join
    • join

      @Nonnull <Y> CollectionJoin<X,Y> join(@Nonnull CollectionAttribute<? super X, Y> collection)
      Create an inner join to the specified Collection-valued attribute.
      Type Parameters:
      Y - the element type of the joined collection
      Parameters:
      collection - target of the join
      Returns:
      the resulting join
    • join

      @Nonnull <Y> SetJoin<X,Y> join(@Nonnull SetAttribute<? super X, Y> set)
      Create an inner join to the specified Set-valued attribute.
      Type Parameters:
      Y - the element type of the joined set
      Parameters:
      set - target of the join
      Returns:
      the resulting join
    • join

      @Nonnull <Y> ListJoin<X,Y> join(@Nonnull ListAttribute<? super X, Y> list)
      Create an inner join to the specified List-valued attribute.
      Type Parameters:
      Y - the element type of the joined list
      Parameters:
      list - target of the join
      Returns:
      the resulting join
    • join

      @Nonnull <K,V> MapJoin<X,K,V> join(@Nonnull MapAttribute<? super X, K, V> map)
      Create an inner join to the specified Map-valued attribute.
      Type Parameters:
      K - the key type of the joined map
      V - the value type of the joined map
      Parameters:
      map - target of the join
      Returns:
      the resulting join
    • join

      @Nonnull <Y> CollectionJoin<X,Y> join(@Nonnull CollectionAttribute<? super X, Y> collection, @Nonnull JoinType jt)
      Create a join to the specified Collection-valued attribute using the given join type.
      Type Parameters:
      Y - the element type of the joined collection
      Parameters:
      collection - target of the join
      jt - join type
      Returns:
      the resulting join
    • join

      @Nonnull <Y> SetJoin<X,Y> join(@Nonnull SetAttribute<? super X, Y> set, @Nonnull JoinType jt)
      Create a join to the specified Set-valued attribute using the given join type.
      Type Parameters:
      Y - the element type of the joined set
      Parameters:
      set - target of the join
      jt - join type
      Returns:
      the resulting join
    • join

      @Nonnull <Y> ListJoin<X,Y> join(@Nonnull ListAttribute<? super X, Y> list, @Nonnull JoinType jt)
      Create a join to the specified List-valued attribute using the given join type.
      Type Parameters:
      Y - the element type of the joined list
      Parameters:
      list - target of the join
      jt - join type
      Returns:
      the resulting join
    • join

      @Nonnull <K,V> MapJoin<X,K,V> join(@Nonnull MapAttribute<? super X, K, V> map, @Nonnull JoinType jt)
      Create a join to the specified Map-valued attribute using the given join type.
      Type Parameters:
      K - the key type of the joined map
      V - the value type of the joined map
      Parameters:
      map - target of the join
      jt - join type
      Returns:
      the resulting join
    • join

      @Nonnull <Y> Join<X,Y> join(@Nonnull String attributeName)
      Create an inner join to the specified attribute.
      Type Parameters:
      Y - the type of the joined attribute
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(SingularAttribute). Use of the typesafe version is strongly preferred.
    • joinCollection

      @Nonnull <Y> CollectionJoin<X,Y> joinCollection(@Nonnull String attributeName)
      Create an inner join to the specified Collection-valued attribute.
      Type Parameters:
      Y - the element type of the joined collection
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(CollectionAttribute). Use of the typesafe version is strongly preferred.
    • joinSet

      @Nonnull <Y> SetJoin<X,Y> joinSet(@Nonnull String attributeName)
      Create an inner join to the specified Set-valued attribute.
      Type Parameters:
      Y - the element type of the joined set
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(SetAttribute). Use of the typesafe version is strongly preferred.
    • joinList

      @Nonnull <Y> ListJoin<X,Y> joinList(@Nonnull String attributeName)
      Create an inner join to the specified List-valued attribute.
      Type Parameters:
      Y - the element type of the joined list
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(ListAttribute). Use of the typesafe version is strongly preferred.
    • joinMap

      @Nonnull <K,V> MapJoin<X,K,V> joinMap(@Nonnull String attributeName)
      Create an inner join to the specified Map-valued attribute.
      Type Parameters:
      K - the key type of the joined map
      V - the value type of the joined map
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(MapAttribute). Use of the typesafe version is strongly preferred.
    • join

      @Nonnull <Y> Join<X,Y> join(@Nonnull String attributeName, @Nonnull JoinType jt)
      Create a join to the specified attribute using the given join type.
      Type Parameters:
      Y - the type of the joined attribute
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      jt - the join type
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(SingularAttribute, JoinType). Use of the typesafe version is strongly preferred.
    • joinCollection

      @Nonnull <Y> CollectionJoin<X,Y> joinCollection(@Nonnull String attributeName, @Nonnull JoinType jt)
      Create a join to the specified Collection-valued attribute using the given join type.
      Type Parameters:
      Y - the element type of the joined collection
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      jt - the join type
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(CollectionAttribute, JoinType). Use of the typesafe version is strongly preferred.
    • joinSet

      @Nonnull <Y> SetJoin<X,Y> joinSet(@Nonnull String attributeName, @Nonnull JoinType jt)
      Create a join to the specified Set-valued attribute using the given join type.
      Type Parameters:
      Y - the element type of the joined set
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      jt - the join type
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(SetAttribute, JoinType). Use of the typesafe version is strongly preferred.
    • joinList

      @Nonnull <Y> ListJoin<X,Y> joinList(@Nonnull String attributeName, @Nonnull JoinType jt)
      Create a join to the specified List-valued attribute using the given join type.
      Type Parameters:
      Y - the element type of the joined list
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      jt - the join type
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(ListAttribute, JoinType). Use of the typesafe version is strongly preferred.
    • joinMap

      @Nonnull <K,V> MapJoin<X,K,V> joinMap(@Nonnull String attributeName, @Nonnull JoinType jt)
      Create a join to the specified Map-valued attribute using the given join type.
      Type Parameters:
      K - the key type of the joined map
      V - the value type of the joined map
      Parameters:
      attributeName - the name of the attribute that is the target of the join
      jt - the join type
      Returns:
      the resulting join
      Throws:
      IllegalArgumentException - if there is no attribute with the given name
      API note:
      This method accepts a string-valued attribute name, and lacks type safety compared to passing a static metamodel element to join(MapAttribute, JoinType). Use of the typesafe version is strongly preferred.
    • treat

      @Nonnull <T extends X> From<?,T> treat(@Nonnull Class<T> type)
      Downcast the bound type to the given type.
      Specified by:
      treat in interface Path<Z>
      Type Parameters:
      T - the subtype of the bound type
      Parameters:
      type - a subtype of the bound type
      Returns:
      this root or join downcast to the given type
      Since:
      4.0