Interface SubqueryInitiator<T>

Type Parameters:
T - The builder type that is returned on terminal operations
All Superinterfaces:
FromBaseBuilder<SubqueryBuilder<T>>
All Known Subinterfaces:
QuantifiableBinaryPredicateBuilder<T>

public interface SubqueryInitiator<T> extends FromBaseBuilder<SubqueryBuilder<T>>
An interface used to create subquery builders.
Since:
1.0.0
Author:
Christian Beikov
  • Method Details

    • getParentQueryBuilder

      CommonQueryBuilder<?> getParentQueryBuilder()
      Returns the parent query builder.
      Returns:
      The parent query builder
      Since:
      1.3.0
    • from

      SubqueryBuilder<T> from(String correlationPath)
      Like from(String, String) with the alias equivalent to the camel cased result of the class of the correlation parent.
      Parameters:
      correlationPath - The correlation path which should be queried
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • from

      SubqueryBuilder<T> from(String correlationPath, String alias)
      Creates a new subquery builder with the given correlation path in the FROM clause with the given alias.
      Parameters:
      correlationPath - The correlation path which should be queried
      alias - The alias for the entity
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • startSet

      Starts a nested set operation builder which is used as subquery. Doing this is like starting a nested query that will be connected via a set operation.
      Returns:
      A new set operation builder for the subquery
      Since:
      1.2.0
    • from

      SubqueryBuilder<T> from(Class<?> entityClass)
      Like from(java.lang.Class, java.lang.String) with the alias equivalent to the camel cased result of what Class.getSimpleName() of the entity class returns.
      Specified by:
      from in interface FromBaseBuilder<T>
      Parameters:
      entityClass - The entity class which should be the entity
      Returns:
      A new subquery builder
    • from

      SubqueryBuilder<T> from(Class<?> entityClass, String alias)
      Creates a new subquery builder with the given entity class as entity in the FROM clause with the given alias.
      Specified by:
      from in interface FromBaseBuilder<T>
      Parameters:
      entityClass - The entity class which should be the entity
      alias - The alias for the entity
      Returns:
      A new subquery builder
    • from

      SubqueryBuilder<T> from(javax.persistence.metamodel.EntityType<?> entityType)
      Like from(EntityType, String) with the alias equivalent to the camel cased result of what EntityType.getName() of the entity class returns.
      Specified by:
      from in interface FromBaseBuilder<T>
      Parameters:
      entityType - The entity type which should be queried
      Returns:
      A new subquery builder
      Since:
      1.3.0
    • from

      SubqueryBuilder<T> from(javax.persistence.metamodel.EntityType<?> entityType, String alias)
      Creates a new subquery builder with the entity class on which the query should be based on with the given alias.
      Specified by:
      from in interface FromBaseBuilder<T>
      Parameters:
      entityType - The entity type which should be queried
      alias - The alias for the entity
      Returns:
      A new subquery builder
      Since:
      1.3.0
    • fromOld

      SubqueryBuilder<T> fromOld(Class<?> entityClass)
      Like from(Class) but explicitly queries the data before any side effects happen because of CTEs.
      Specified by:
      fromOld in interface FromBaseBuilder<T>
      Parameters:
      entityClass - The entity class which should be queried
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • fromOld

      SubqueryBuilder<T> fromOld(Class<?> entityClass, String alias)
      Like from(Class, String) but explicitly queries the data before any side effects happen because of CTEs.
      Specified by:
      fromOld in interface FromBaseBuilder<T>
      Parameters:
      entityClass - The entity class which should be queried
      alias - The alias for the entity
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • fromNew

      SubqueryBuilder<T> fromNew(Class<?> entityClass)
      Like from(Class) but explicitly queries the data after any side effects happen because of CTEs.
      Specified by:
      fromNew in interface FromBaseBuilder<T>
      Parameters:
      entityClass - The entity class which should be queried
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • fromNew

      SubqueryBuilder<T> fromNew(Class<?> entityClass, String alias)
      Like from(Class, String) but explicitly queries the data after any side effects happen because of CTEs.
      Specified by:
      fromNew in interface FromBaseBuilder<T>
      Parameters:
      entityClass - The entity class which should be queried
      alias - The alias for the entity
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • fromValues

      SubqueryBuilder<T> fromValues(Class<?> valueClass, String alias, int valueCount)
      Creates a new subquery builder with a VALUES clause for values of the given value class in the from clause. This introduces a parameter named like the given alias. To set the values invoke ParameterHolder.setParameter(String, Object) or Query.setParameter(String, Object) with the alias and a collection.
      Specified by:
      fromValues in interface FromBaseBuilder<T>
      Parameters:
      valueClass - The class of the basic or managed type for which to create a VALUES clause
      alias - The alias for the entity
      valueCount - The number of values to use for the values clause
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • fromValues

      SubqueryBuilder<T> fromValues(Class<?> entityBaseClass, String attributeName, String alias, int valueCount)
      Creates a new subquery builder with a VALUES clause for values of the type as determined by the given entity attribute to the from clause. This introduces a parameter named like the given alias. To set the values invoke ParameterHolder.setParameter(String, Object) or Query.setParameter(String, Object) with the alias and a collection.
      Specified by:
      fromValues in interface FromBaseBuilder<T>
      Parameters:
      entityBaseClass - The entity class on which the attribute is located
      attributeName - The attribute name within the entity class which to use for determining the values type
      alias - The alias for the entity
      valueCount - The number of values to use for the values clause
      Returns:
      The new subquery builder
      Since:
      1.3.0
    • fromIdentifiableValues

      SubqueryBuilder<T> fromIdentifiableValues(Class<?> valueClass, String alias, int valueCount)
      Creates a new subquery builder with a VALUES clause for values of the given value class in the from clause. This introduces a parameter named like the given alias. In contrast to fromValues(Class, String, int) this will only bind the id attribute. To set the values invoke ParameterHolder.setParameter(String, Object) or Query.setParameter(String, Object) with the alias and a collection.
      Specified by:
      fromIdentifiableValues in interface FromBaseBuilder<T>
      Parameters:
      valueClass - The class of the identifiable type for which to create a VALUES clause
      alias - The alias for the entity
      valueCount - The number of values to use for the values clause
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • fromValues

      <X> SubqueryBuilder<T> fromValues(Class<X> valueClass, String alias, Collection<X> values)
      Like fromValues(Class, String, int) but passes the collection size as valueCount and directly binds the collection as parameter via ParameterHolder.setParameter(String, Object).
      Specified by:
      fromValues in interface FromBaseBuilder<T>
      Type Parameters:
      X - The type of the values
      Parameters:
      valueClass - The class of the basic or managed type for which to create a VALUES clause
      alias - The alias for the entity
      values - The values to use for the values clause
      Returns:
      A new subquery builder
      Since:
      1.2.0
    • fromValues

      SubqueryBuilder<T> fromValues(Class<?> entityBaseClass, String attributeName, String alias, Collection<?> values)
      Like fromValues(Class, String, String, int) but passes the collection size as valueCount and directly binds the collection as parameter via ParameterHolder.setParameter(String, Object).
      Specified by:
      fromValues in interface FromBaseBuilder<T>
      Parameters:
      entityBaseClass - The entity class on which the attribute is located
      attributeName - The attribute name within the entity class which to use for determining the values type
      alias - The alias for the entity
      values - The values to use for the values clause
      Returns:
      The new subquery builder
      Since:
      1.3.0
    • fromIdentifiableValues

      <X> SubqueryBuilder<T> fromIdentifiableValues(Class<X> valueClass, String alias, Collection<X> values)
      Like fromIdentifiableValues(Class, String, int) but passes the collection size as valueCount and directly binds the collection as parameter via ParameterHolder.setParameter(String, Object).
      Specified by:
      fromIdentifiableValues in interface FromBaseBuilder<T>
      Type Parameters:
      X - The type of the values
      Parameters:
      valueClass - The class of the identifiable type for which to create a VALUES clause
      alias - The alias for the entity
      values - The values to use for the values clause
      Returns:
      A new subquery builder
      Since:
      1.2.0