Class ConstructorQueryMappings

java.lang.Object
org.eclipse.persistence.internal.jpa.jpql.ConstructorQueryMappings

public final class ConstructorQueryMappings extends Object
This object scans a DatabaseQuery and checks if it's a constructor query. If it is one, then the fully qualified class name and the persistent fields will be available.
Since:
2.5
Version:
2.5
  • Method Details

    • getClassName

      public String getClassName()
      Returns the class name used to define the constructor expression.
      Returns:
      Either the fully qualified class name used in the constructor expression or null if the query is not a constructor query
    • getQuery

      public DatabaseQuery getQuery()
      Returns the DatabaseQuery for which its JPQL query was scanned to check if it's constructor query and if so, to gather the information.
      Returns:
      The DatabaseQuery that was scanned
    • isConstructorQuery

      public boolean isConstructorQuery()
      Determines whether the JPQL query is a constructor query, i.e. the select expression is a constructor expression.

      Example: SELECT new test.example.Employee(e.name, e.id) FROM Employee e

      Returns:
      true if the SELECT clause has a single select item and it's a constructor expression; false otherwise
    • mappings

      public Iterable<DatabaseMapping> mappings()
      Returns a non-null Iterable over the ordered list of DatabaseMapping objects that represents the parameter arguments defined in the constructor expression.
      Returns:
      The list contains the persistent fields that were passed to the constructor