Notes on OpenJPA query internals and JPQL processing.
- There is a name conflict between
QueryImplin the JDBC store andQueryImplin the kernel. - The JPQL parser is
openjpa.kernel.jpql.JPQLParser. - Joins are performed by
SelectImpl. - Subselects have some issues, especially with non-relationship columns.
src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjtcontains the parser rules.- Every query always has a "candidate class".
openjpa.jdbc.kernel.exps.JDBCExpressionFactoryandopenjpa.kernel.exps.InMemoryExpressionFactoryboth implementopenjpa.kernel.exps.ExpressionFactory.- In-memory filtering is possible by downcasting the JPA
Queryinstance and passing it a collection to filter. - Entity parameters can be traversed via
:param.firstnameor:param.relationship.deptname. DBDictionarycontains fields that can be customized per database type.JPQLExpressionBuilderperforms semantic analysis by walking the syntax tree and generating the semantic tree.SQLFactoryImplconstructs the SQL for the query.SQLBufferis the result of applyingDBDictionaryrules to the semantic tree.SQLBufferinstances can be appended to one another, e.g. for subselects.SQLBufferis almost aStringBuffer.ResultSetResultcallsResultSet.getIntand similar methods.