This package defines a semantic model of HQL queries.
Our implementation of the JPA
Semantic Query Model (SQM)An SQM is a tree representing the semantic interpretation of a query. It's "semantic" in the sense that it contains more information than a simple syntax tree.
HQLHQL is interpreted as an SQM with the help of an ANTRL-generated parser. The class
SemanticQueryBuilderis responsible for visiting the syntax tree produced by the parser and building an SQM.
Criteria queriesThe SQM tree nodes directly implement the JPA criteria query contracts. For example,
Our implementation of the JPA
CriteriaBuilder interface is
It instantiates SQM nodes and arranges them into SQM tree using the
standard operations for building a JPA criteria query.
Transforming SQM to SQLThe package
org.hibernate.sql.astdefines an AST representing SQL. To generate SQL from SQM, we must transform the SQM tree to a SQL AST tree. This process is described here, and is handled by a
- API Note:
- This entire package is in an incubating state.
Interface Summary Interface Description NodeBuilderAdapts the JPA CriteriaBuilder to generate SQM nodes. SemanticQueryWalker<T>Support for walking a Semantic Query Model (SQM) tree SqmExpressible<J>Anything in the application domain model that can be used in an SQM query as an expression SqmJoinable<O,E>Specialization for attributes that that can be used in creating SQM joins todo (6.0) : should we define this for entities as well to handle cross joins and "entity joins"? - the result type would need to change to just SqmJoin... SqmPathSource<J>Represents any part of the domain model which can be used to create a
SqmSelectionQuery<R> SqmTreeCreationLoggerLogger used to log information about the creation of an SQM tree. SqmTreeTransformationLogger
Enum Summary Enum Description BinaryArithmeticOperatorEnumeration of standard binary arithmetic operators CastTypeDefines the set of basic types which should be accepted by the
cast()function on every platform.
ComparisonOperatorDefines the comparison operators. DynamicInstantiationNatureRepresents the type of instantiation to be performed. FetchClauseTypeThe kind of fetch to use for the
FrameExclusion FrameKind FrameMode IntervalTypeThe different types of intervals that SQL defines. SetOperatorThe SQL set operators. SqmQuerySourceInformational - used to identify the source of an SQM statement. StrictJpaComplianceViolation.Type TemporalUnitA temporal field type which can occur as an argument to
extract()or as the unit of a duration expression.
Exception Summary Exception Description AliasCollisionException EntityTypeExceptionIndicates that a reference to an entity, that is, a given entity name or Java class object, did not resolve to a known mapped entity type. InterpretationExceptionRepresents a generic unhandled problem which occurred while translating HQL/JPQL. LiteralNumberFormatException ParsingExceptionOccurs when an unexpected condition is encountered while interpreting the output of the HQL parser. PathElementExceptionIndicates that an element of a path did not resolve to a mapped program element. StrictJpaComplianceViolationIndicates violations of strict JPQL syntax while strict JPQL syntax checking was enabled. TerminalPathExceptionIndicates an attempt to dereference a terminal path (usually a path referring to something of basic type) UnknownEntityExceptionIndicates a failure to resolve an entity name in HQL to a known mapped entity type. UnknownPathExceptionIndicates a failure to resolve an element of a path expression in HQL/JPQL.