[hibernate-dev] SQM interpretation in my antlr-4-poc repo

Steve Ebersole steve at hibernate.org
Mon Sep 21 14:47:00 EDT 2015


Just a heads up that I finally got enough traction in this work towards
building a "SQL AST" to warrant a push upstream.

The majority of time has been trying to think through the best tree
structure for modeling from clauses especially in regards to
entity/collection persisters that map across multiple tables. So that is
where most of my work so far has gone.  So far I have only worked through
handling entity persisters.  You can see this contract
in org.hibernate.sql.orm.internal.mapping.ImprovedEntityPersister (which I
ultimately expect to augment the upstream EntityPersister contract with).
There are also some tests illustrating the structure that gets created for
various scenarios.  So far I have only written tests for
SingleTableEntityPersister (which covers both no inheritance and
discriminator inheritance) with and without secondary tables.  I will work
on expanding the covered scenarios as I have time during continued 5.0.2
and 5.1 development.

For those interested in taking a peek, the tree structure itself is defined
within the org.hibernate.sql.ast.from package.  Be sure to see its
package-info for a high-level overview.

The tests are in the org.hibernate.sql.orm.internal.mapping test package.

The next steps (after filling out the tested scenarios) is to start work on
resolving AttributeReferences from the SQM using
the TableSpecificationGroup as a means to resolve the specific table
aliases needed for each column.  After that, building the rest of the tree
ought to be pretty straight forward.

The other major task is to still account for "Dialect variance" (join
support, casting, etc).


More information about the hibernate-dev mailing list