Class IdentificationVariableDeclarationStateObject

  • All Implemented Interfaces:
    ListHolderStateObject<JoinStateObject>, StateObject, VariableDeclarationStateObject

    public class IdentificationVariableDeclarationStateObject
    extends AbstractIdentificationVariableDeclarationStateObject
    An identification variable is a valid identifier declared in the FROM clause of a query. All identification variables must be declared in the FROM clause. Identification variables cannot be declared in other clauses. An identification variable must not be a reserved identifier or have the same name as any entity in the same persistence unit: Identification variables are case insensitive. An identification variable evaluates to a value of the type of the expression used in declaring the variable.
    BNF: identification_variable_declaration ::= range_variable_declaration { join | fetch_join }*

    Version:
    2.4
    See Also:
    IdentificationVariableDeclaration
    Author:
    Pascal Filion
    Since:
    2.4
    • Constructor Detail

      • IdentificationVariableDeclarationStateObject

        public IdentificationVariableDeclarationStateObject​(AbstractFromClauseStateObject parent)
        Creates a new IdentificationVariableDeclarationStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        Throws:
        java.lang.NullPointerException - The given parent cannot be null
      • IdentificationVariableDeclarationStateObject

        public IdentificationVariableDeclarationStateObject​(AbstractFromClauseStateObject parent,
                                                            IEntity entity,
                                                            java.lang.String identificationVariable)
        Creates a new IdentificationVariableDeclarationStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        entity - The external form of the entity to add to the declaration list
        identificationVariable - The unique identifier identifying the abstract schema name
        Throws:
        java.lang.NullPointerException - The given parent cannot be null
      • IdentificationVariableDeclarationStateObject

        public IdentificationVariableDeclarationStateObject​(AbstractFromClauseStateObject parent,
                                                            java.lang.String entityName,
                                                            java.lang.String identificationVariable)
        Creates a new IdentificationVariableDeclarationStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        entityName - The name of the entity name
        identificationVariable - The new identification variable
        Throws:
        java.lang.NullPointerException - The given parent cannot be null
    • Method Detail

      • addInnerJoinFetch

        public JoinStateObject addInnerJoinFetch​(java.lang.String path)
        Adds a new INNER JOIN FETCH expression to this declaration.
        Parameters:
        path - The join association path expression
        Returns:
        A new JoinStateObject
      • addJoinFetch

        public JoinStateObject addJoinFetch​(java.lang.String path)
        Adds a new JOIN FETCH expression to this declaration.
        Parameters:
        path - The join association path expression
        Returns:
        A new JoinStateObject
      • addJoinFetch

        public JoinStateObject addJoinFetch​(java.lang.String joinFetchType,
                                            java.util.ListIterator<java.lang.String> paths)
        Adds a new JOIN FETCH expression to this declaration.
        Parameters:
        joinFetchType - One of the joining types: LEFT JOIN FETCH, LEFT OUTER JOIN FETCH, INNER JOIN FETCH or JOIN FETCH
        paths - The join association path expression
        Returns:
        A new JoinStateObject
      • addJoinFetch

        public JoinStateObject addJoinFetch​(java.lang.String joinFetchType,
                                            java.lang.String path)
        Adds a new JOIN FETCH expression to this declaration.
        Parameters:
        joinFetchType - One of the joining types: LEFT JOIN FETCH, LEFT OUTER JOIN FETCH, INNER JOIN FETCH or JOIN FETCH
        path - The join association path expression
        Returns:
        A new JoinStateObject
      • addJoinFetchType

        public JoinStateObject addJoinFetchType​(java.lang.String joinFetchType)
        Adds a new JOIN FETCH expression to this declaration.
        Parameters:
        joinFetchType - One of the joining types: LEFT JOIN FETCH, LEFT OUTER JOIN FETCH, INNER JOIN FETCH or JOIN FETCH
        Returns:
        A new JoinStateObject
      • addLeftJoinFetch

        public JoinStateObject addLeftJoinFetch​(java.lang.String path)
        Adds a new LEFT JOIN FETCH expression to this declaration.
        Parameters:
        path - The join association path expression
        Returns:
        A new JoinStateObject
      • addLeftOuterJoinFetch

        public JoinStateObject addLeftOuterJoinFetch​(java.lang.String path)
        Adds a new LEFT OUTER JOIN FETCH expression to this declaration.
        Parameters:
        path - The join association path expression
        Returns:
        A new JoinStateObject
      • getEntity

        public IEntity getEntity()
        Returns the actual external form representing the IEntity.
        Returns:
        The actual IEntity or null if no entity exists with the entity name
      • getEntityName

        public java.lang.String getEntityName()
        Returns the name of the entity for which it is used as the "root" of the declaration.
        Returns:
        The name of the entity
      • getManagedType

        public IManagedType getManagedType​(StateObject stateObject)
        Returns the IManagedType for the given identification variable. The search does not traverse up the query hierarchy if this declaration is for a subquery.
        SELECT e FROM Department d JOIN KEY(d.employees).addresses a
        In the above query, the managed type associated with the identification variable:
        • d is "Department"
        • a is "Address"
        Parameters:
        stateObject - The StateObject that should be an simple identification variable or an encapsulated identification variable with the identifier KEY or VALUE
        Returns:
        The IManagedType representing the domain object declared by the given identification variable
      • setEntity

        public void setEntity​(IEntity entity)
        Sets the IEntity as the "root".
        Parameters:
        entity - The IEntity itself
      • setEntityName

        public void setEntityName​(java.lang.String entityName)
        Sets the name of the abstract schema, which is the name of the entity.
        Parameters:
        entityName - The name of the entity