[hibernate-dev] HQL Grammar for "ON" joins...
Steve Ebersole
steve at hibernate.org
Thu Sep 20 12:16:08 EDT 2007
On Thursday 20 September 2007 09:14:47 am James Carman wrote:
> What do you guys think about this...
>
> fromClause
>
> : FROM^ { weakKeywords(); } fromRange ( onJoin | pathJoin | COMMA! {
>
> weakKeywords(); } fromRange )*
> ;
>
> onJoin
>
> : ( ( ( LEFT | RIGHT ) (OUTER)? ) | FULL | INNER )? JOIN^
>
> identifier asAlias ON^ logicalExpression
> ;
>
> pathJoin
>
> : ( ( ( LEFT | RIGHT ) (OUTER)? ) | FULL | INNER )? JOIN^ (FETCH)?
>
> path (asAlias)? (propertyFetch)? (withClause)?
> ;
>
> The "pathJoin" is basically what we currently support. The "onJoin"
> is what we want to support. Does it look correct to you?
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
At a bare minimum this would not work because the identifier sub-rule result
(recognized after JOIN) would need to be resolved before allowing the lexer
to continue on to the resolution of the logicalExpression sub-rule.
But even more basic, I don't think "identifier" is the correct sub-rule here.
It would catch imported entity name scenarios, but obviously fail on
non-imported entity names (aka FQN).
Have you looked the grammars I started for the re-work of the query parser?
It is obviously more work to go this route, but much more correct imo.
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/hibernate/core/branches/HQL_ANTLR_2/g2/
More information about the hibernate-dev
mailing list