Max Rydahl Andersen wrote:
Now when we are adding EJBQL support is there a "easy" (read not to hacky) way
of e.g. letting the parser complain if a user is actually using HQL only syntax ?
Here are some ways to do this:
1) Add some state to the grammar (it already knows about filter vs. non-filter) and create semantic predicates that switch some of the rules on and off. This might clutter up the grammar a bit, but ANTLR has support for semantic predicates. You could even have semantic verification predicates that will cause the parse to fail after the construct has been recognized (easy, and not too hacky).
2) Detect EJBQL constructs in semantic analysis and throw a semantic error (this is what will happen right now). :)
3) Make another grammar that inherits HQL and adds new syntax. This could be a little trickier, but it's potentialy much cleaner.
I'm just thinking that from a user point of view it would be nice to run in a "ejb3 only" mode
and be told if he crosses the line into the other side ;)
Agreed. Right now, the later phases of the query translator will complain about the new EJB3 nodes in the tree, so that will just happen albeit in an ugly way. :)
Will we need to have a special EJBQL semantic analysis phase as well? I was thinking yesterday that there isn't much point in adding new syntax to the parser without adding it to the other phases of the query translator. In otherwords, somtheting has to understand the tree that the parser makes, right?
/max
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel